Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1

When I run npm install, I face the following error. I am not able to find the problem.

I need some help in finding this issue.

d:\testing\node-sample-module\node_modules\ffi\node_modules\ref\node_modules\nan\nan_implementation_pre_12_inl.h(112): error C2668: 'v8::FunctionTemplate::New' :  ambiguous call to overloaded function [d:\TESTING\node-sample-module\node_modules \ffi\node_modules\ref\build\binding.vcxproj]
C:\Users\SELVA\.nw-gyp\0.8.5\deps\v8\include\v8.h(3344): could be 'v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::FunctionCallback,v8::Handle<v8::Value>,v8::Handle<v8::Signature>,int)'
C:\Users\SELVA\.nw-gyp\0.8.5\deps\v8\include\v8.h(3343): or v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::InvocationCallback,v8::Handle<v8::Value>,v8::Handle<v8::Signature>,int)' while trying to match the argument list '(int, v8::Local<v8::Value>,    v8::Local<v8::Signature>)'

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (c:\Users\SELVA\AppData\Roaming\npm\node_modules\nw-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "c:\\Users\\SELVA\\AppData\\Roaming\\npm\\node_modules\\nw-gyp\\bin\\nw-gyp.js" "clean" "configure" "--target=0.8.5" "build" "--arch=ia32"
gyp ERR! cwd d:\TESTING\node-sample-module\node_modules\ffi\node_modules\ref
gyp ERR! node -v v0.10.35
gyp ERR! nw-gyp -v v0.12.4
gyp ERR! not ok

FYI, I am using windows 7 machine.

Also, have the following installed:

  • Visual C++ Redistributable 2013 (32 bit)

  • Python 2.7.3 (env variable set to path/python.exe)

  • Visual studio Express 2013

  • .Net framework 4.5 SDK

Thanks in Advance.

like image 651
SELVA Avatar asked Oct 06 '15 07:10

SELVA


3 Answers

For me it was because I was running node 14. Try downdrading your node version to node 12. Its pretty easy to do if you are using NVM

like image 196
mikeysee Avatar answered Nov 15 '22 03:11

mikeysee


Update:

A new package will do all of this for us now.

Make sure you have the sufficient permissions by running:

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

then run:

npm install -g windows-build-tools

wait for it to install and then run:

window-build-tools

and everything should be in its finest order.


Old answer:

I just went through some of the same issues as you. I spun up a fresh installation of Windows 8.1 in Hyper-V, went through the installation process and jotted things down a long the way. It seems that you have all the necessary tools installed.

I think the only think you might be missing (not being entirely sure though) could be setting the msvs_version-flag when running npm install - so try seeing if this helps:

npm install --msvs_version=2013

Now that I've done all these notes I might as well put them here, so people that experience the same kind of problems might find some help.

My recipe on a freshly installed machine:

1) Install Node.js

2) Install git

  • CLI commands should be executed with administrator rights
  • Select "Use Git and optional Unix tools from the Windows Command Prompt

    • git-add-to-path

3) Upgrade npm to npm 3.x.x (optional step)

Even though you've just installed Node.js it doesn't necessarily mean you have npm in version 3.

  • CLI commands should be executed with administrator rights
  • Run npm install -g npm-windows-upgrade in the command line interface.
  • Run Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force in the command line interface
  • Run npm-windows-upgrade in the command line interface
  • Select the newest version and let it install
  • When it finishes the install run npm --version and make sure it responds with something like 3.x.x

4) Install Python 2.7.x

  • Go to https://www.python.org/downloads
  • Click the button to download Python 2.7.x
  • Run the installer.
  • Select Install for all users - click next.
  • Select to install in C:\Python27 - click next

    • python-location
  • Be sure to select Will be installed on local hard drive in Add python.exe to Path - click next

    • python-add-to-path-01

    • python-add-to-path-02

    • python-add-to-path-03

  • Finish up the installation

5) Install Visual Studio Express 2013 for Windows Desktop with Update 4

Even if you have another version of Visual Studio installed on your system do install this as well.

  • Go to http://www.microsoft.com/en-gb/download/details.aspx?id=44914
  • Select English or some other available language and click Download
  • Check wdexpress_full.exe and click "Next"
  • Run the file downloaded. Begin the installation.
  • If you're unable to start the installation, it means you already have the necessary tools for this step. Abort the installation.

Now run npm install --msvs_version=2013 and you should be able to reach the end without node-gyp throwing errors.

like image 24
Brian Frisch Avatar answered Nov 15 '22 03:11

Brian Frisch


For me on Windows 10 and Node 13, I had to uninstall Visual Studio and Build Tools, and uninstall Node 13. Then, I deleted npm and npm-cache from Roaming, before reinstalling Node 11.6 and choosing to install Chocolately. It worked for me thereafter.

like image 1
user5305519 Avatar answered Nov 15 '22 03:11

user5305519