npm gyp build error on windows 8 - node.js

My npm installation appears to be incomplete in some way :/. I've been testing with npm -g install buffertools --msvs_version=2013 , but I have tried quite a few others. I thought my setup worked previously under node .10 but after upgrading to 0.12.5, it's been non-stop headaches. I removed everything and reinstalled, no love. My Windows 7 box had no trouble :/.
My setup:
Python 2.7.10
node 0.12.5
npm 2.11.2
VStudio 2013 (Professional)
The error:
...\.node-gyp\0.12.5\Release\node.lib : fatal error LNK1106: invalid file or disk full: cannot seek to 0x1B844 [...\AppData\Roaming\npm\no
de_modules\buffertools\build\buffertools.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_mo
dules\npm\node_modules\node-gyp\lib\build.js:269:23)
I tried updating/reinstalling node-gyp
I tried updating npm
I tried using --msvs_version=2013
I've tried installing the node-v0.12.5-x86 and the node-v0.12.5-x64 versions... :). I'm attempting to run this on a Surface 2 Pro with Windows 8.1 on it.
I also installed with Windows 7.1 SDK.
I only have one version of Python installed, and it is in path. Also, I am running npm in a command shell as Administrator.
I'm not that familiar with the internals of what npm/node-gyp is doing, so I'm not sure where to go next in debugging this problem without diving into the internals of npm (which I'd rather not do :( ). I gather it is attempting to kick off a Vis Studio build on a vcxproj. Therein, I'm sure this is just a stupid configuration piece/thing I've forgotten to install. I'm especially weirded out because I had no problems with node 0.10 which I had installed and working no problem on this machine up until today.

I could be totally off here, but just a thought - you'll likely need Administrative privileges to save to the Program Files directory. The error seems to indicate that it's unable to wri
Are you running this with a privileged account?

Related

node gyp says build tools are undefined

I have installed the latest Visual Studio Build tools 2022 using these instructions: https://github.com/nodejs/node-gyp#on-windows
Windows 7 Enterprise x64
node -v v14.15.0
npm -v 6.14.5
node-gyp#9.1.0
This is my env:
This is my .npmrc file:
msvs_version=2017
msbuild_path=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe
Following the path to my build tools:
Following the MSBuild.exe I run this file and get:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe
The error message when trying to install a package I get is:
npm install
Now it gets interesting: running gyp configure I don't get the same error:
I wonder what else can I do? I went trough countless threads and couldn't resolve this issue.
I have a machine with windows 10 on, and did the exact same procedure and it works. But here, the path to the build tools can't be found.
According to your screenshot you are using node-gyp 5.1.0, not 9.1.0, which is three years old at this point. So it not finding Visual Studio 2022, which was released last year, isn't unexpected.
You need to update your node-gyp version (or node, since node v14 is also old). If you update to a new version of node the installer will ask you if you want to install the build tools as well which is usually a good idea.
If you however want to upgrade your current node-gyp you can follow these steps, assuming node is installed in C:\Program Files\nodejs\ (taken from the node-gyp docs)
cd "C:\Program Files\nodejs\node_modules\npm\node_modules\#npmcli\run-script"
npm install node-gyp#latest

How to fix node.js error like "gyp ERR! find VS including the "Desktop development with C++" workload." when I launch Nuxt.js project

I have used Nuxt.js in my latest project and I changed the new PC to development
my project.
So I installed node.js same as I usual procedure.
And then I launched new nuxt.js project used by "create-nuxt-app" in command. but, error message is occurred like below.
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
I think this error message is depend on the node.js.
So, I followed these error message and I installed "Visual Studio" with C++ using Visual Studio Installer in my Windows PC.
but still same error occurred.
I tried to use "windows-build-tools" command in PowerShell of Admin.
command is like that.
npm install --global --production windows-build-tools
but still same error occurred.
and I thought node version might be high, so I need to down node version "14.15.1" to "14.10.1".
but never fix my problem.
I almost gave up, but nuxt.js are installed correctly.
I have to fix it.
I searched many times but I couldn't fix it.
Please anyone advise me? Please......
I followed this pages.
first of all, I made binding.gyp file in "C:\Users\your user name\build" like below.
{
"targets": [{
"target_name": "binding",
"sources": [ "binding.vcxproj" ]
}]
}
my code "sources" is binding to "VS ++C".
In window Command prompt run below command↓
$ node-gyp configure
↓
$ node-gyp configure --msvs_version=2019※I already installed vs_version=2019
↓
$ node-gyp build
That's it ! It was really simple way to pass c++ with node.js.

Error: Cannot find module 'shrink-ray'

After using the amazing angular-fullstack-generator though Yeoman, I followed the setup instructions, and when I came to running npm start or gulp serve I got the following error:
Error: Cannot find module 'shrink-ray'
Seemed pretty self-explanitory, so I ran npm install shrink-ray, and doing so gave me the following error:
node-pre-gyp ERR! Tried to download(403): https://node-zopfli.s3.amazonaws.com/Releas
e/zopfli-v1.4.0-node-v48-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for node-zopfli#1.4.0 and node#6.9.2 (
node-v48 ABI) (falling back to source compile with node-gyp)
Building the projects in this solution one at a time. To enable parallel build, pleas
e add the "/m" switch.
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To f
ix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2
005 or 3) add the location of the component to the system path if it is installed el
sewhere. [C:\Users\alicia.sykes\Dropbox\Coding\Angular\team-awesome\node_modules\no
de-zopfli\build\binding.sln]
Again, this error looked pretty self-explanatory, so I followed the steps it suggested - but it didn't work. The same error always returned, preventing me from installing shrink-ray.
After many hours of Googling, it looked like a combination of issues between:
node-gyp
The NPM and node version installed
C++ build tools (why, I have no idea)
Having the Python environmental variable pointing to
the correct installation location of either Python 2.7 or 3.1
Some of these factors modified the error message - but none were the solution.
The solution was in fact simple:
(as admin/sudo) run: npm install --global --production windows-build-tools
This was provided by the very helpful Adonay28 on this GitHub
issue, here:
https://github.com/angular-fullstack/generator-angular-fullstack/issues/2462#issuecomment-275112118
For this to work, you do also need to have:
Python 2.7 or 3.1 installed
The latest version of npm (4.5.0 works). Run: npm i npm -g to update.
And node-gyp installed globally. Run npm install -g node-gyp
Hope this helps someone else, to get there app running quicker thank I did!

npm install zmq issue

I am doing npm install zmq but stuck in strange error, please see below
C:\Users\Administrator>npm install zmq
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available too
ls versions are "4.0".
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:\Program Files\nodejs\node_modules\
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:789:
12)
googled but with no luck.
this is a fresh install on windows server 2012. and zmq is already installed using windows msi installer, but i want to use zmq under nodejs so doing npm.
i think msbuild is failing as node is assuming version 2 of .net framework, however installed .net version is 4.
can any one please guide me how to solve the issue - thanks
regards
zishan
right, thanks Gustav, I solved it by installing visual studio 2012.
first I changed the .net version from 4 to 2 by going to server manager, than I got another error where it says the system requires .net v2 sdk then i installed the sdk and finally visual studio 2012 of 5 gb.
problem solved but i am amazed why we have to install 5 gb of vs to make zmq work, can it not be done only by linking the required dll or library, why it requires whole bunch of vb files!
any ways its done.
"npm install zmq" requires Visual Studio 2013 or less, Python 2.7.x
If you have multiple versions of Visual Studio, run this script to make 2013 as default :-
set gyp_msvs_version=2013
or you can try this other official package - "zeromq"
with zeromq, you don't have to worry about all the binaries. It comes with pre-build binaries for win(32/64), Linux(64), OS X/ Darwin(64 bit)
"npm install zeromq"

Cannot install node modules that require compilation on Windows 7 x64/VS2012

I cannot install any of the modules that require compilation. All they fail with the following error:
MSBUILD : error MSB3411: Could not load the Visual C++ component "VCBuild.exe". ...
My environment:
Windows 7 Enterprise x64, version 6.1.7601
node x86 0.8.16
npm 1.2.0
node-gyp 0.8.2
Visual Studio 2012 and numerous packages
Related environment variables:
Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShel l\v1.0;C:\Program Files\TortoiseGit\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\tools;c:\tools\node
No INCLUDE, LIB, LIBPATH, etc.
I did a short investigation of the issue and figure out that with the following setup the manual compilation (calling VCBuild.exe and msbuild.exe directly) succeed for the manually cloned git://github.com/einaros/ws.git:
SET Configuration=Release
SET PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC\vcpackages
SET PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\bin;%PATH%
SET PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\Common7\IDE;%PATH%
SET PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%
SET PATH=%SystemRoot%\system32;%PATH%
SET INCLUDE=%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\include
SET INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE%
SET LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Lib
SET LIB=%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\lib;%LIB%
SET MSBUILD="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"
VCBuild.exe C:\Tools\node\ws\build\bufferutil.vcproj "Release|Win32" /useenv
VCBuild.exe C:\Tools\node\ws\build\validation.vcproj "Release|Win32" /useenv
%MSBUILD% build/binding.sln /verbosity:diagnostic /nologo /p:Configuration=Release;Platform=Win32
I've tried to call node-gyp with the same variables and it failed:
C:\!> git clone https://github.com/einaros/ws.git
C:\!> cd ws
C:\!\ws>node-gyp configure
...
C:\!\ws>node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp#0.8.2
gyp info using node#0.8.16 | win32 | ia32
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=Win32' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Users\User\.node-gyp\0.8.16\deps\uv\include\uv.h(55): fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory [C:\!\
ws\build\binding.sln]
C:\Users\User\.node-gyp\0.8.16\deps\uv\include\uv.h(55): fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory [C:\!\
ws\build\binding.sln]
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:\Tools\node\node_modules\node-gyp\lib\build.js:255:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "c:\\Tools\\node\\\\node.exe" "c:\\Tools\\node\\node_modules\\node-gyp\\bin\\node-gyp.js" "build"
gyp ERR! cwd C:\!\ws
gyp ERR! node -v v0.8.16
gyp ERR! node-gyp -v v0.8.2
gyp ERR! not ok
Maybe you will have some ideas about it?
Thanks.
Try that - will set it globally:
npm config set msvs_version 2012 --global
To do it without VS2010 installation, and only 2012, set the msvs_version flag:
node-gyp rebuild --msvs_version=2012
npm install <module> --msvs_version=2012
as per #Jacob comment
npm install --msvs_version=2013 if you have the 2013 version
Update v3:
https://www.npmjs.com/package/windows-build-tools
npm install --global windows-build-tools
downloads and installs Visual C++ Build Tools 2015, provided free of charge by Microsoft. These tools are required to compile popular native modules. It will also install Python 2.7, configuring your machine and npm appropriately.
Update v2:
node-gyp updated their readme to include HOW-TO for windows
Original:
No need for the entire visual studio, you can download just the build tools
Microsoft Build Tools 2013 : http://www.microsoft.com/en-us/download/details.aspx?id=40760
run cmd to set global flag to use the 2013 version:
npm config set msvs_version 2013 --global
after this everything should be back to normal and your npm install / node-gyp rebuild will work
just add --msvs_version=2012
node-gyp rebuild --msvs_version=2012
or
node-gyp configure --msvs_version=2012
node-gyp build
I had the same issue when trying to install a package for Node.js. After some extensive googeling I found this walktrough: https://github.com/TooTallNate/node-gyp/wiki/Visual-Studio-2010-Setup
When I had followed these steps I could use "npm install" without any issues.
Thanks to #felixrieseberg, you just need to install windows-build-tools npm package and you are good to go.
npm install --global --production windows-build-tools
You won't need to install Visual Studio.
You won't need to install Microsoft Build Tools.
From the repo:
After installation, npm will automatically execute this module, which
downloads and installs Visual C++ Build Tools 2015, provided free of
charge by Microsoft. These tools are required to compile popular
native modules. It will also install Python 2.7, configuring your
machine and npm appropriately.
Windows Vista / 7 requires .NET Framework 4.5.1 (Currently not
installed automatically by this package)
Both installations are conflict-free, meaning that they do not mess with existing installations of Visual Studio, C++ Build Tools, or
Python.
on windows 8, it worked for me using :
npm install -g node-gyp -msvs_version=2012
then
npm install -g restify
After DAYS of digging, someone on IRC suggested that I try to use the
Windows 7.1 SDK Command Prompt
Shortcut (links to C:\Windows\System32\cmd.exe /E:ON /V:ON /T:0E /K "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd"). I think you MUST have the older 7.1 SDK (even on Windows 8.1) because the newer ones use msbuild.exe instead of vcbuild.exe which is what node-gyp wants even though it's twice as old as node at this point :/
Once in that prompt, I had to run the following to get x86 context because the compiler was throwing as error otherwise about architecture:
setenv.cmd /Release /x86
THEN I was able to successfully run npm commands that were trying to use node-gyp to recompile things.
I had the same isuee and did all the magic above, the only thing that did the magic for me is from https://github.com/atom/atom/issues/2435
"Because the --msvs_version=2013 is not passed to node-gyp when it's run by the build script. Set the GYP_MSVS_VERSION = 2013 env variable and it should work after."
Bang! it worked
On Windows
This helped me: (credits goes to) https://github.com/TooTallNate/node-gyp/wiki/Updating-npm%27s-bundled-node-gyp
I tried MINGW32, but with no success.
on cmd.exe
$ cd "C:\Program Files\nodejs\node_modules\npm"
$ npm install -g node-gyp#latest
For windows 8 64-bit, installing zmq and protobuf, the following worked for me:
Install Visual Studio 2012
On the command line:
SET VisualStudioVersion=11.0
npm install zmq
npm install protobuf
I think the solution is to download
install Microsoft windows sdk for server 2008 with .net framework 3.5
or just install Visual studio 2008.
The issue is for windows builds node-gyp executes vcbuid.exe file, and for some reason it can't find it.
Thanks
Install Python 2.7 (not 3.x)
Add the path to the directory containing vcbuild.exe on your environment variable PATH
If you need vcbuild.exe get it here https://github.com/kin9puppy/vcbuildFixForNode
I had also a lot of problem to compile nodejs zmq.
For the problem with with vcbuild.exe, just add it to the PATH
For other problems I could compile just using Windows 7.1 SDK Command Prompt
(Menu Programs -> Microsoft Windows SDK v7.1 -> Windows 7.1 SDK Command Prompt)
And from the prompt:
npm install zmq
That's works :)
After a long struggle, I've switched my node architecture to x86 and it worked like a charm.
in cmd set Visual Studio path depending upon ur version as
Visual Studio 2010 (VS10): SET VS90COMNTOOLS=%VS100COMNTOOLS%
Visual Studio 2012 (VS11): SET VS90COMNTOOLS=%VS110COMNTOOLS%
Visual Studio 2013 (VS12): SET VS90COMNTOOLS=%VS120COMNTOOLS%
In node-master( original node module downloaded from git ) run vcbuild.bat with admin privileges.
vcbild.bat will generate windows related dependencies and will add folder name Release in node-master
Once it run it will take time to build the files.
Then in the directory having .gyp file use command
node-gyp rebuild --msvs_version=2012 --nodedir="Dive Name:\path to node-master\node-master"
this will build all the dependencies.
I solved this problem on windows 8 and windows 10 pro with this tutorial.
I try a lot of times to solve this problem with many different solutions, but only worked for me with this:
http://www.serverpals.com/blog/building-using-node-gyp-with-visual-studio-express-2015-on-windows-10-pro-x64
I notice that i didn't use nodist to control the node version like this tutorial, I use NVM and worked fine, i don't test this tutorial with nodist. I used node 5.2.0.

Resources