node-gyp troubles with installation

a 夏天 提交于 2019-11-30 05:31:10

问题


I'm trying to install webworker-threads, a node addon that requires gyp. I followed the gyp instructions for setup, so far I'm still getting an error when trying to "rebuild":

C:\Program Files\nodejs\node_modules\webworker-threads>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp ERR! configure error
gyp ERR! stack Error: spawn ENOENT
gyp ERR! stack at errnoException (child_process.js:980:11)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:771:34)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Program Files\nodejs\node_modules\webworker-threads
gyp ERR! node -v v0.10.8
gyp ERR! node-gyp -v v0.9.5
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0

I'm on a Windows 7 32 bit system. Sooo to spare some time here's my personal checklist:

Paths: node is in both user and system path. npm is in user path. Python path is set too.

  • Python: 2.7.3 installed at C:\Python27
  • VisualStudio C++ 2010 AND 2012 Express installed
  • node version v0.10.8
  • ran everything with administrator privileges
  • Commands executed: npm install -g node-gyp
  • npm install webworker-threads
  • Then the error appears.

Do you guys by any chance notice something I'm doing wrong?

Thanks a lot in advance for your guidance!


回答1:


try npm install –msvs_version=2012. This command will ask NPM to use visual studio 2012 to build.

http://www.kevgriffin.com/specifying-visual-studio-version-in-npm-installs/




回答2:


After spending a while to get this to work (for me accepted answer didn't work, for me it's just half solution) i did following:

  1. Sadly, you must have visual studio (i installed express edition 2013 for DESKTOP)
  2. Installed python 2.7.3 (you don't have to set any environment variables)
  3. Run cmd as administrator and go to you project root (where is you package.json file)
  4. First run: npm config set python C:\Python27\python.exe
  5. Then: npm install -msvs_version=2013

The trick is in command npm config set python ...path_to_python_exe... which will be provided by npm to dependency which needs python i guess.




回答3:


Got Windows 7 64 bit.

Did all the above but I still got the error which was mentioned.

What worked for me was:

  1. Uninstall Microsoft .NET Frameworks (I got more than one version)
  2. Open regedit and navigating to: hkey_local_machine/software/Microsoft/MSBuild
  3. Remove all .net versions (I got there 2 and 3.5 sub directories)
  4. If You have OS 64 Bit repeat steps 2 & 3 for %WinDir%\SysWOW64\regedit.exe
  5. Reinstall Microsoft .NET Framework

Hope it will spare some time for you.



来源:https://stackoverflow.com/questions/16833655/node-gyp-troubles-with-installation

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