命令行报错
npm install
npm WARN deprecated fsevents@2.1.3: "Please update to latest v2.3 or v2.2"
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
> heapdump@0.3.15 install D:\Work\XXX\node_modules\heapdump
> node-gyp rebuild
D:\Work\XXX\node_modules\heapdump>if not defined npm_config_node_gyp (node "C:\Users\BBB\AppData\Roaming\nvm\v14.20.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebu
ild ) else (node "C:\Users\BBB\AppData\Roaming\nvm\v14.20.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if the py launcher can be used to find Python 2
gyp ERR! find Python - "py.exe" is not in PATH or produced an error
gyp ERR! find Python checking if Python is C:\Python27\python.exe
gyp ERR! find Python - "C:\Python27\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Python37\python.exe
gyp ERR! find Python - "C:\Python37\python.exe" could not be run
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
gyp ERR! find Python (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python npm config set python "C:\Path\To\python.exe"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack at PythonFinder.fail (C:\Users\BBB\AppData\Roaming\nvm\v14.20.0\node_modules\npm\node_modules\node-gyp\lib\find-python.js:307:47)
gyp ERR! stack at PythonFinder.runChecks (C:\Users\BBB\AppData\Roaming\nvm\v14.20.0\node_modules\npm\node_modules\node-gyp\lib\find-python.js:136:21)
gyp ERR! stack at PythonFinder.<anonymous> (C:\Users\BBB\AppData\Roaming\nvm\v14.20.0\node_modules\npm\node_modules\node-gyp\lib\find-python.js:225:16)
gyp ERR! stack at PythonFinder.execFileCallback (C:\Users\BBB\AppData\Roaming\nvm\v14.20.0\node_modules\npm\node_modules\node-gyp\lib\find-python.js:271:16)
gyp ERR! stack at exithandler (child_process.js:390:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! heapdump@0.3.15 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the heapdump@0.3.15 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\BBB\AppData\Roaming\npm-cache\_logs\2023-03-20T08_52_13_595Z-debug.log
根据报错提示python环境问题
操作步骤
1、安装node-gyp
npm install -g node-gyp
2、安装python
https://www.python.org/download/releases/2.7/
选择2.7.0的版本
安装一步步操作即可
3、配置python环境变量
如果没更改路径 是在你的C盘
测试是否安装成功
4、配置环境变量
点击 我的电脑–属性–高级系统设置–环境变量–系统变量–Path --新增
5、npm 配置
这里我都是默认的安装路径没有改
npm config set python “C:\Python27\python.exe”
npm config set node_gyp “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js”