node-gyp build error windows x64

2020-01-26 03:31发布

Here's what I've done so far on my x64 OS:

  • Installed Python (v2.7 --specifically 2.7.6) and added it to the system path (C:\Python27)
  • Installed MS VS C++ 2010 Express Version (I already had VS 2012 but without the C++ component)
  • Installed the compiler update for Windows SDK 7.1
  • Successfully executed node-gyp configure (from my add-on directory under nodejs\node_modules where binding.gyp is located)

  • ran node-gyp build (as administrator)** This is what crashed, leaving me with:

this error:

C:\Program Files\nodejs\node_modules\msnodesql>node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@0.12.2
gyp info using node@0.10.25 | win32 | x64
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the   "/m" switch.

LINK : fatal error LNK1181: cannot open input file 'kernel32.lib' [C:\Program Files\nodejs\node_modules\msnodesql\build\sqlserver.vcxproj]

gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\RNelson\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Users\\RNelson\\AppData\\Roaming\\npm\\node_modules\\node-      gyp\\bin\\node-gyp.js" "build"
gyp ERR! cwd C:\Program Files\nodejs\node_modules\msnodesql
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok

Any ideas as to what is going on? Thanks in advance! Just trying to use my node-sqlserver MS driver for Node.js

10条回答
叼着烟拽天下
2楼-- · 2020-01-26 03:52

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

查看更多
叼着烟拽天下
3楼-- · 2020-01-26 03:52

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.

查看更多
对你真心纯属浪费
4楼-- · 2020-01-26 03:54

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

查看更多
倾城 Initia
5楼-- · 2020-01-26 03:55

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.
查看更多
登录 后发表回答