node-gyp build error windows x64

帅比萌擦擦* 提交于 2019-11-27 00:02:19

npm config set msvs_version 2013 --global worked for me as I use VS node tools and you dont need to specify msvs_version each time you do an npm install.

I had an issue whereby npm's config (c:\Users\username\ .npmrc) has an entry msvs_version=2012 which was out of date.

I had a similar problem. I found that this switch helped me

--msvs_version=2012

so for example

npm install --msvs_version=2012 <package>

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. I don't know why setting python as env variable is not enough.

If all above did not work (my case - Windows10 64bit)

Delete C:\Users\user_name\.node-gyp

Delete %AppData%/npm

Delete %AppData%/npm-cache

And install node-gyp again

Following instruction on node-gyp page

I chose Option 1 npm install --global --production windows-build-tools

For installing node-gyp in windows or any other OS

First you may have to download the node-gyp by

$ npm install -g node-gyp-install

Then install by

$ npm install -g node-gyp

you may need to do the above procedure as root/administrartor.

I had this same error now in 2015 when trying to install Keystone and I ran through all you told me but it didn't work on it's own. At the end, I just had to run the command

"C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\SetEnv.CMD" /Release /x64

to set up the environment before running the command. (Don't freak out when it turns your window text green, it's working). So yeah I'd do the installations and set up environment variables in the same way everywhere on the internet suggests but make sure to run the above command before running any other command. It probably won't be useful to you, but hopefully it's useful to someone else. If that still doesn't work, MSVS version 2010 worked for me, so install that version and use the flag -msvs_version=2010 when running the npm command.

For me the solution that worked with VS express was to simply install Visual Studio 2013 Express for desktop (which is the only one that gives you a developer command prompt as of 2013 version). Open developer command prompt (elevated) and run NPM install commands. This did not require any special --msvs_version arguments, it just worked.

DieterDP

I came across this problem myself, and this is how I solved it using Visual Studio 2010:

Install following packages

Use npm install from the Windows SDK command prompt (you need this because it sets additional environment variables).

Source: node-gyp instructions for VS2010

For me (Windows 7 64bit),

I struggled with this issue for half of a day Finally It worked.

On my way :

  1. At control panel, I deleted all Python, Microsoft Visual Studio, Microsoft Redistributable, and something about I installed to solve this.

  2. Window Update and restart.

  3. Installed Python27, and Visual Studio 2013 with no setting env-val

  4. npm install node-gyp -g

  5. I got an error same thing, but after npm config set msvs_version 2013 --global , It works.

there is an easy to use windows build tools global node package. You could try this.

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