As part of trying to use a node NPM dependency in a project, I get a node-gyp rebuild
issue, which I have reported.
I am aware of the solution in this SO question, but it does not work for Windows 10 (I am on 32 bits, I don’t know whether this is relevant). Windows SDK 7.1 (and others) won’t install.
Does anyone have an operational solution for Windows 10?
Udpate
After trying npm install <module name> --msvs_version=2013
, I get a new error message:
asked Sep 8, 2015 at 12:23
Jérôme VerstryngeJérôme Verstrynge
57.9k92 gold badges284 silver badges456 bronze badges
5
This worked for me:
npm install --global --production windows-build-tools
answered Sep 15, 2018 at 1:32
1
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 this
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.
Edit:
Following the suggested by @prasun, the steps in correct order:
- Download and install Git SCM from HERE
- Download Visual Studio Community HERE and install a Custom Installation, selecting ONLY the following packages: VISUAL C++, PYTHON TOOLS FOR VISUAL STUDIO and MICROSOFT WEB DEVELOPER TOOLS
- Download and install Python 2.7.x from HERE
- Register a Environment Variable with name: GYP_MSVS_VERSION with this value: 2015.
This is the only steps work for me in windows 8.1 and windows 10.
answered Dec 28, 2015 at 16:46
Marco BlosMarco Blos
9589 silver badges22 bronze badges
1
To install node addons, you need to have VC/VCExpress installed and not just the VC runtime/redistributable. Make sure it’s the «Windows Desktop» edition.
After that, you should be able to install addons via npm (you may have to re-open any command prompts you had open before installing VCExpress though).
answered Sep 8, 2015 at 19:56
mscdexmscdex
105k15 gold badges194 silver badges154 bronze badges
1
При установке npm-пакетов относительно часто вижу сообщения об ошибках, связанных с node-gyp.js. Пример с установкой gulp-combine-mq: https://gist.github.com/nicothin/1353fb8d63d7ece71792 Пакет, поставленный с такими ошибками, конечно, не работает.
Я нашел инструкцию https://github.com/nodejs/node-gyp#installation но там требуется ставить Visual Studio Community 2015, а это 16 ГБ — take.ms/Xyjat, что как-то некомильфо.
Есть ли какие-то другие способы, кроме переноса рабочего процесса в виртуалку с Ubuntu?
Может, где-то можно взять уже собранный вариант этой утилиты, чтобы не убивать несколько часов времени и 16 гигов места ради элементарнейшей функции объединения медиа-конструкций в CSS?
-
Вопрос задан
-
9176 просмотров
Пригласить эксперта
Win8. Мне помогло по вашей второй ссылке. А именно вот эта команда:
npm install --global --production windows-build-tools
16 Гб выкачивать не пришлось. Я правда начал устанавливать Visual C++ Build Tools (4Гб), а параллельно запустил команду. Но мне кажется достаточно одной только команды (проверил, так и есть….проверил повторно, похоже эти 4 гб он по этой команде устанавливает). «Оно» само скачало и установило Python2.7 и Visual Studio Build Tools. Затем я смог установить node-static и socket.io. А не получалось потому что кто-то из них требовал пересобрать node-gyp.
Community 2015, а это 16 ГБ
Отожмите галки вообще со всего кроме поддержки visual с++
-
Показать ещё
Загружается…
08 окт. 2023, в 23:50
5000 руб./за проект
08 окт. 2023, в 21:59
1000 руб./в час
08 окт. 2023, в 20:00
10000 руб./за проект
Минуточку внимания
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. Unfortunately, this is not the case with Windows, as is evidenced by this thread from 2015. 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.
This guide is meant to help solve the issues that can arise when installing a package that requires node-gyp
.
1. Try running npm install
with the --no-optional
flag.
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 –no-optional
to install only the required dependencies.
If you run this and still get the error, I have bad news: You’re in for a bit of a ride. As we begin our journey into getting node-gyp
up and running, here’s an important note for all of the steps that follow. 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.
2. Try downloading the windows-build-tools
package.
According to the node-gyp
documentation, this step should be the end-all-be-all solution to fixing node-gyp
problems. For most people, that’s true. 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.
The good news is that installing this package should take care of all of the wiring up of these components. The bad news is that there are a lot of things included in it.
Depending on the version you download, it can hover between three and eight gigabytes (all to get some dependencies installed!). 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.
You can download them by running this command: npm install --global --production windows-build-tools --vs2015
Important note
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. However, node-gyp
requires the v140
distributable, not the v150
(which comes with VS2017). 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. You can see more notes about that near the bottom of the package’s website.
Hopefully, that’s all it will take for you to get everything installed. If you’ve still got issues, then you’re going to have to grab all of the required files manually.
3. Download the Visual Studio 2015 build tools manually.
Rather than installing the build tools through NPM, download them manually. You can find them on the Microsoft download page. Once they’re downloaded, just run the installer.
4. Tell Node to use the 2015 build tools.
Now that we have the build tools, we need to tell Node to use them. You’ll have to run this command: npm config set msvs_version 2015 –global
5. Make sure you have Python 2.7 installed.
Next up is to download Python 2.7. This is important–by default, you’ll install the newest version (3.x.x), but only 2.7 is compatible with node-gyp
. 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.
If you have another version of Python already installed, that’s okay. They can coexist with each other. You can grab Python 2.7 at this link.
6. Set your Node config to use Python 2.7.
Now that you have Python 2.7, you’re going to have to set Node to use it by default. To do that, run this command: npm config set python python2.7
If you followed the last few steps, you should now have everything necessary to get node-gyp
working. Make sure you’ve restarted your terminal and are running it as an administrator, and try doing your install again. Hopefully, at this point, you can successfully install the dependencies you need. If not, we’re going to have to try one last thing.
7. Repeat Step 2 with the Visual Studio 2017 build tools.
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
. If you look online, you’ll see lots of other people with the same problem, including some of the commenters on this StackOverflow question.
However, most of the documentation around node-gyp
and compiling native Node modules on Windows doesn’t specify to use the --vs2015
flag, and some even mention downloading the 2017 version. If you’re still having issues with getting node-gyp
to run, try repeating Step 2 while omitting the --vs2015
flag.
8. Try installing an older version of Node.
Still getting an installation error? Try installing an older version of Node. If you’re on an experimental version, try going back to the last stable release (and then make sure that you’re actually using that version when you try and do npm install
).
If that still doesn’t work, try going back to Node 8. You’ll find some issues online of people having issues with Node 10 that were resolved by downgrading to Node 8, and sometimes newer versions of Node don’t play nice with node-gyp
.
9. File an issue.
If you’re still having trouble getting node-gyp
to work, then your issue probably doesn’t fall into one of the more common problems. It’s worth doing some research online to see if that solves your problem. Otherwise, your best option is to file an issue on the GitHub page for node-gyp
and see what advice you can get there.
Other Resources
Much of this information can now be found on the GitHub readme for node-gyp, but it wasn’t always there. It only made an appearance after a few thousand posts from disgruntled Windows users who just wanted to install some dependencies. Even then, the information is missing some of the issues that arise with installing the wrong version of the build tools.
Another great resource is Microsoft’s guide on working with Node on Windows. It even has sections dedicated to compiling native Node modules and resolving basic node-gyp
problems.
Additionally, this question on StackOverflow contains useful answers and comments regarding this issue. Leave a note in the comments if you’ve found anything else helpful in solving node-gyp
issues!
Same problem here
npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated gulp-header@1.8.9: Removed event-stream from gulp-header
npm WARN deprecated chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated cryptiles@2.0.5: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated sntp@1.0.9: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated formidable@1.0.17: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated request@2.81.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated mkdirp@0.3.0: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@4.2.1: this library is no longer supported
npm WARN deprecated express@2.5.11: express 2.x series is deprecated
npm WARN deprecated hawk@3.1.3: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated connect@1.9.2: connect 1.x series is deprecated
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup [
npm WARN cleanup 'I:\\Kivitelezes\\PeterBurgerEU\\Tarhely\\gulpteszt\\resume-bootstrap4-master\\node_modules\\glob-watcher\\node_modules',
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\glob-watcher\node_modules\globule\test\fixtures\expand\deep'] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: 'EPERM',
npm WARN cleanup syscall: 'rmdir',
npm WARN cleanup path: 'I:\\Kivitelezes\\PeterBurgerEU\\Tarhely\\gulpteszt\\resume-bootstrap4-master\\node_modules\\glob-watcher\\node_modules\\globule\\test\\fixtures\\expand\\deep'
npm WARN cleanup }
npm WARN cleanup ],
npm WARN cleanup [
npm WARN cleanup 'I:\\Kivitelezes\\PeterBurgerEU\\Tarhely\\gulpteszt\\resume-bootstrap4-master\\node_modules\\glob-watcher',
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\glob-watcher\node_modules\globule\test\fixtures\expand\deep'] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: 'EPERM',
npm WARN cleanup syscall: 'rmdir',
npm WARN cleanup path: 'I:\\Kivitelezes\\PeterBurgerEU\\Tarhely\\gulpteszt\\resume-bootstrap4-master\\node_modules\\glob-watcher\\node_modules\\globule\\test\\fixtures\\expand\\deep'
npm WARN cleanup }
npm WARN cleanup ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli 'I:\\Kivitelezes\\PeterBurgerEU\\Tarhely\\gulpteszt\\resume-bootstrap4-master\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@18.12.1 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:207:21)
npm ERR! gyp verb `which` failed python2 Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:207:21) {
npm ERR! gyp verb `which` failed code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python C:\Python311\python.EXE
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Python311\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR! gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:412:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
npm ERR! gyp ERR! stack at Socket.<anonymous> (node:internal/child_process:449:11)
npm ERR! gyp ERR! stack at Socket.emit (node:events:513:28)
npm ERR! gyp ERR! stack at Pipe.<anonymous> (node:net:313:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "I:\\Kivitelezes\\PeterBurgerEU\\Tarhely\\gulpteszt\\resume-bootstrap4-master\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\node-sass
npm ERR! gyp ERR! node -v v18.12.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Beci\AppData\Local\npm-cache\_logs\2022-11-10T16_25_40_106Z-debug-0.log
Node-Gyp Error On Windows 10 With Code Examples
In this post, we will examine how to solve the Node-Gyp Error On Windows 10 problem using examples from the programming language.
how to fix this issue follow this step by step 1. open with run as powershell 2. npm i windows-build-tools -g 3. wait 5 minute, after 5 minute npm i node-gyp -g 4. enjoy successfully to install node-gyp
Through many examples, we learned how to resolve the Node-Gyp Error On Windows 10 problem.
How do I reinstall node-gyp?
On Windows Install the current version of Python from the Microsoft Store package. Install tools and configuration manually: Install Visual C++ Build Environment: Visual Studio Build Tools (using «Visual C++ build tools» workload) or Visual Studio Community (using the «Desktop development with C++» workload)14-Jul-2022
Is Python required for node-gyp?
node-gyp dependencies js should cover it for you. However, if you are an add-on developer, you probably need to install node-gyp globally. To use node-gyp, first, we’ll need to install a Python runtime, the make utility, and a C or C++ compiler.12-Nov-2021
Why is node-gyp required?
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.27-Mar-2019
What is node-gyp folder?
node-gyp folder is the devDir of node-gyp (see relevant source code). This is where development header files are copied in order to perform the compilation of native modules. you can safely delete this directory, as it will be re-created the next time you’ll install a module that needs node-gyp .15-Nov-2013
How do I update gyp?
“how to upgrade node-gyp” Code Answer
- In cmd,
- where node.
- $ cd «C:\Program Files\nodejs\node_modules\npm»
- $ npm install -g node-gyp@latest.
How do I manually install windows build tools?
To manually install the xPack Windows Build Tools, unpack the archive and copy it into the %USERPROFILE%\AppData\Roaming\xPacks\windows-build-tools (for example C:\Users\ilg\AppData\Roaming\xPacks\windows-build-tools ) folder; according to Microsoft, AppData\Roaming is the recommended location for installing user
What version of Python does node gyp need?
node-gyp requires that you have installed a compatible version of Python, one of: v3.7, v3.8, v3.9, or v3.10.
How do I install Python on Windows 10?
3 at the time of writing this article.
- Step 1: Download the Python Installer binaries. Open the official Python website in your web browser.
- Step 2: Run the Executable Installer. Once the installer is downloaded, run the Python installer.
- Step 3: Add Python to environmental variables.
- Step 4: Verify the Python Installation.
Where is Python path in Windows?
py installed location is C:\Windows\py.exe if installed for all users, otherwise can be found at C:\Users\username\AppData\Local\Programs\Python\Launcher . It does not require the environment PATH variable to be set if installed for all users.
How do I uninstall node?
How to Completely Uninstall Node. js?
- Clean the NPM Cache using npm cache clean —force.
- Uninstall everything and reboot (or kill all node processes).
- Remove the folders as per the architecture ‘Program Files\Nodejs’, ‘\Users\{User}\AppData\Roaming\npm’, ‘\Users\{User}\.npmrc’