npm install reports error command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild

Execute npm install error message

December 10th 20:27
npm ERR! code 1
npm ERR! path C:\wamp64\www\kyy2.0\xgwx2\node_modules\images
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Can’t find Python executable “python”, you can set the PYTHON env variable.
npm ERR! gyp ERR! stack at PythonFinder.failNoPython (C:\wamp64\www\kyy2.0\xgwx2\node_modules\node-gyp\lib\configure.js:484:19)
npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (C:\wamp64\www\kyy2.0\xgwx2\node_modules\node-gyp\lib\configure.js:509:16)
npm ERR! gyp ERR! stack at callback (C:\wamp64\www\kyy2.0\xgwx2\node_modules\graceful-fs\polyfills.js:299:20)
npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command “C:\\Program Files\\nodejs\\node.exe” “C:\\wamp64\\www\\kyy2.0\\xgwx2\\node_modules\\node-gyp\\bin\\node-gyp.js” “rebuild”
npm ERR! gyp ERR! cwd C:\wamp64\www\kyy2.0\xgwx2\node_modules\images
npm ERR! gyp ERR! node -v v16.13.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

The reason for the error is that the local python environment is missing.

First execute npm install -g node-gyp to install node-gyp globally.

Execute node-gyp list. If prompted that node-gyp install is required, execute node-gyp install again.

Execute npm install –global –production windows-build-tools to install the python environment

*If the execution fails, it may be because the npm version is too high. Reduce the npm version to 6 (it can be upgraded after installation) or use cnpm to install it.

After the installation is successful, pay attention to the installed python information (it may be a subversion of python2.7, you need to pay attention)

After successful installation, you need to perform the following two steps

1. Environment variable settings

Add the installation path eg \Users\.windows-build-tools\python27 in the Path line

2.cmd set npm config set python python2.7.15 (mine is 2.7.15, you need to set the complete version number)

At this time, executing python in cmd will display python information.

eg:

Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>>

This means that python has been installed successfully

Just re-execute npm install normally.

Related Posts

[Data structure] Huffman tree and Huffman coding implementation (C language)

VMware virtual machine installs the original MAC OS system and easily experiences the Apple operating system

[Set Sail] OpenHarmony Expedition 01

C language version – data structure – final course design – major homework (airline passenger booking system) with source code + experimental documents

Windows 11 configure JDK environment variables

Where can I view the system logs of Windows system servers?

Install VMware on MAC M1 and install windows11

[LeetCode]Replace spaces&&disappeared numbers&&split linked list&&product of arrays except itself

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*