How do I get node-gyp to work on Windows 7 platform

谁说我不能喝 提交于 2019-11-30 04:54:24

Although this question is one month old, i ended up searching across the web and this was part of search results.

So here is a not-should-do-but-it-works answer.

First, i'm not familiar with node-gyp or the whole visual studio compile and stuff, i really really feel sorry for node-gyp depending on python (a really silent WTF )

So for no known reason nodejs version older than 0.10.22 (i'm running that now so i assume there it where it starts)

If you search your system for the file "uv.h" you might get some results IF you have previously installed nodejs versions, otherwise you could keep reading.

my previous 0.10.3 nodejs version had uv.h into node-gyp some like

<DRIVERLETTER>:\Users\<USERNAME>\.node-gyp\0.10.3\deps\uv

so if you read the npm documentation you will find the the argument on npm install

The --nodedir=/path/to/node/source argument will allow npm to find the node source code so that npm can compile native modules.

so the final command should be

npm install <package> --nodedir="<DRIVERLETTER>:\Users\<USERNAME\.node-gyp\0.10.3"

you might get some warnings but it should complete with success.

Before you do anything, update Node and NPM by installing from the the node website (updating node and npm via npm appears to be busted on Windows. I'm not sure those delete-and-reinstall-everything-in-order instructions are current but that would most certainly be a major PITA which was what inspired me to look for alternatives given that that post was a little old in node years.

Ultimately, this resolved an issue for me with node-gyp as a dependency for the pg module and it ran with vs 2013, I believe (or at least that's what it appeared to be looking for before it started working).

This is what helped me resolve it:

For some reason i had node-gyp in two different directories.

Directory 1:

C:\Users\Imran Bughio\.node-gyp\0.10.21\

Directory 2:

C:\Users\Imran Bughio\Documents\.node-gyp\0.10.21\


In 2nd directory i had a uv folder inside deps folder but that folder was not there in 1st directory.

Here is the path -- note it had uv.h file inside.

C:\Users\Imran Bughio\.node-gyp\0.10.21\deps\uv

SOLUTION:

I simply moved the uv & all the other extra folders from directory 2 to directory 1.

@Phoenix answer gave me a little hint, which ultimately helped me resolve this so, Thanks Phoenix.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!