

- #NPM CONFIG SET PYTHON PYTHON2.7 INSTALL#
- #NPM CONFIG SET PYTHON PYTHON2.7 FULL#
- #NPM CONFIG SET PYTHON PYTHON2.7 DOWNLOAD#
I’ve personally had issues when I’ve tried to download the 2017 version of the build tools, even when trying to use newer versions of node-gyp. Repeat Step 2 with the Visual Studio 2017 build tools. If not, we’re going to have to try one last thing.
#NPM CONFIG SET PYTHON PYTHON2.7 INSTALL#
Hopefully, at this point, you can successfully install the dependencies you need. Make sure you’ve restarted your terminal and are running it as an administrator, and try doing your install again. If you followed the last few steps, you should now have everything necessary to get node-gyp working. To do that, run this command: npm config set python python2.7 Now that you have Python 2.7, you’re going to have to set Node to use it by default. If you have another version of Python already installed, that’s okay. If you try to use a newer version of Python, you’ll get a syntax error due to print being made into an actual function in Python 3. This is important–by default, you’ll install the newest version (3.x.x), but only 2.7 is compatible with node-gyp. You’ll have to run this command: npm config set msvs_version 2015 –global 5. Now that we have the build tools, we need to tell Node to use them. Once they’re downloaded, just run the installer. You can find them on the Microsoft download page. Rather than installing the build tools through NPM, download them manually. Download the Visual Studio 2015 build tools manually. If you’ve still got issues, then you’re going to have to grab all of the required files manually.

Hopefully, that’s all it will take for you to get everything installed. You can see more notes about that near the bottom of the package’s website. This is why the -vs2015 flag is added to the end of the command, since that’s the last version of Visual Studio that came with the v140 package. However, node-gyp requires the v140 distributable, not the v150 (which comes with VS2017). If you run this command without any additional flags, you’ll install the files associated with the latest version of Visual Studio, which is VS2017 at the time of writing. You can download them by running this command: npm install -global -production windows-build-tools -vs2015 Important note The install can take upwards of 30 minutes depending on your connection, so don’t despair if it seems like the install is hanging for a while. The bad news is that there are a lot of things included in it.ĭepending on the version you download, it can hover between three and eight gigabytes (all to get some dependencies installed!). The good news is that installing this package should take care of all of the wiring up of these components. NPM has a package called windows-build-tools that should automatically install everything you need to get node-gyp working, including the Microsoft build tools, compilers, Python, and everything else required to build native Node modules on Windows. Try downloading the windows-build-tools package.Īccording to the node-gyp documentation, this step should be the end-all-be-all solution to fixing node-gyp problems. Make sure that you’re always working in an elevated terminal (with administrator privileges) and that you restart your console whenever a download is complete. As we begin our journey into getting node-gyp up and running, here’s an important note for all of the steps that follow. If you run this and still get the error, I have bad news: You’re in for a bit of a ride. Try running npm install –no-optional to install only the required dependencies. If you’re lucky, the dependency that requires node-gyp will be optional, and you can skip the entire process required to get it working. Try running npm install with the -no-optional flag. This guide is meant to help solve the issues that can arise when installing a package that requires node-gyp.
#NPM CONFIG SET PYTHON PYTHON2.7 FULL#
The Windows environment makes getting node-gyp to work a less-than-stellar developer experience, full of multiple pitfalls and many ways for things to go wrong.

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