Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does node-gyp (and other stuff) require Visual Studio?

node-gyp isn't the first thing I've run into requiring it, but this seems odd. I assume this has something to do with building executables or plugins or whatever but is there no dependency smaller than a complete version of Visual Studio or VS Express that can fit the bill? I though you could actually write, build and run .net apps without a copy of VS if you really wanted to. I ask with intent to at least learn some C++ or whatever else it takes while attempting to address the problem although I imagine it's nontrivial if Joyent couldn't find a way around it easily enough.

Note: I'm not having a problem with node-gyp as a node dependency but Windows users with that issue should try updating node by downloading from the web and reinstalling from that exe file before doing any of the other madness out there that I narrowly dodged. They seem to have fixed the 2010-only issue without really announcing it very loudly and npm doesn't really work when attempting to update itself and Node on Windows.

like image 287
Erik Reppen Avatar asked Nov 16 '14 17:11

Erik Reppen


People also ask

Does node js need Visual Studio?

It works without Visual Studio, but you'll need to install Windows SDK: Get Windows SDK from https://www.microsoft.com/en-us/download/details.aspx?id=8442.

Why is node-gyp needed?

node-gyp is a tool that enables the compilation of native add-on modules for Node in multiple platforms. It has widespread use and is included as a dependency in many NPM packages. On most systems, this isn't an issue, and installing node-gyp with the rest of your packages works as expected.

Does node-gyp require Python?

node-gyp requires that you have installed a compatible version of Python, one of: v3. 7, v3. 8, v3. 9, or v3.

What is npm install node-gyp?

node-gyp-build works similar to node-gyp build except that it will check if a build or prebuild is present before rebuilding your project. It's main intended use is as an npm install script and bindings loader for native modules that bundle prebuilds using prebuildify .


3 Answers

It works without Visual Studio, but you'll need to install Windows SDK:

  1. Get Windows SDK from https://www.microsoft.com/en-us/download/details.aspx?id=8442
  2. Use "SDK command line" shortcut on your desktop to launch npm install

I found this solution here: https://github.com/nodejs/node-gyp/issues/629#issuecomment-138276692

like image 175
rdxi Avatar answered Oct 11 '22 13:10

rdxi


Update: You can download latest build tools here. Recent announcements here and here.

Original answer: Finally Microsoft is providing much better solution. A standalone Microsoft Visual C++ Build Tools 2015 Technical Preview. More info here and here

like image 5
igor Avatar answered Oct 11 '22 14:10

igor


EDIT:

Please note that the official Node.js for Windows installer can now automatically install the required tools. That's likely a much better option than the module listed here (windows-build-tools).


ORIGINAL ANSWER:

I was able to run node-gyp 0.8.x on Windows 10 without Visual Studio using the windows-build-tools.

Install the build tools with this one-liner. Start PowerShell as Administrator and run:

npm install --global windows-build-tools

And wait for the installation to complete.

like image 4
Douglas Nassif Roma Junior Avatar answered Oct 11 '22 14:10

Douglas Nassif Roma Junior