Vue学习笔记之Vue项目启动gyp ERR! find Python

2023-07-09 15:27:17 浏览数 (2)

0x00 报错详细

该报错在Windows和MacOS平台均会出现,项目启动时候报错如下:

代码语言:javascript复制
E:vue-adminnode_modulesfibers>if not defined npm_config_node_gyp (node "D:nodejsnode_modulesnpmnode_modulesnpm-lifecyclenode-gyp-bin\....node_modulesnode-gypbinnode-gyp.js" rebuild --releas
e )  else (node "D:nodejsnode_modulesnpmnode_modulesnode-gypbinnode-gyp.js" rebuild --release )

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:Python27python.exe
gyp ERR! find Python - "C:Python27python.exe" could not be run
gyp ERR! find Python checking if Python is C:Python37python.exe
gyp ERR! find Python - "C:Python37python.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:PathTopython.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:PathTopython.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 (D:nodejsnode_modulesnpmnode_modulesnode-gyplibfind-python.js:307:47)
gyp ERR! stack     at PythonFinder.runChecks (D:nodejsnode_modulesnpmnode_modulesnode-gyplibfind-python.js:136:21)
gyp ERR! stack     at PythonFinder.<anonymous> (D:nodejsnode_modulesnpmnode_modulesnode-gyplibfind-python.js:225:16)
gyp ERR! stack     at PythonFinder.execFileCallback (D:nodejsnode_modulesnpmnode_modulesnode-gyplibfind-python.js:271:16)
gyp ERR! stack     at exithandler (child_process.js:315:5)
gyp ERR! stack     at ChildProcess.errorhandler (child_process.js:327:5)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)
gyp ERR! stack     at onErrorNT (internal/child_process.js:468:16)
gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:80:21)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "D:\nodejs\node.exe" "D:\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd E:lx-fr-admin-uinode_modulesfibers
gyp ERR! node -v v14.5.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows   OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g   build-essential`
RHEL users please run: `yum install gcc-c  ` and `yum groupinstall 'Development Tools'`
Alpine users please run: `sudo apk add python make g  `
'nodejs' 不是内部或外部命令,也不是可运行的程序
或批处理文件。


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fibers@4.0.3 install: `node build.js || nodejs build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fibers@4.0.3 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!     D:nodejsnode_cache_logs2020-07-17T00_46_32_338Z-debug.log

0x01 解决方法

1.1 安装node-gyp

代码语言:javascript复制
npm install -g node-gyp

1.2 安装python

推荐安装2.7版本(自行选择32位或者64位安装), 选择官方python2.7最后更新版本:

0x02 参考

gyp ERR! find Python 解决方案

0 人点赞