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

后端 未结 3 1831
北海茫月
北海茫月 2020-12-29 08:01

My attempts to use node-gyp on a Windows 7 + Node.js platform have failed [3] when attempting to compile the standard \"Hello World\" example [2]. Note: node-gyp is failing

3条回答
  •  长发绾君心
    2020-12-29 08:26

    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

    :\Users\\.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  --nodedir=":\Users\

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

提交回复
热议问题