npm install项目时报错,度娘也没能解决
本帖最后由 lifeixue 于 2021-11-19 15:31 编辑npm install 命令后,报错信息如下:gyp verb `which` failed at G:\qtadmin\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:195:21) {
gyp verb `which` failed code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Users\xuqui\AppData\Local\Programs\Python\Python39\python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\xuqui\AppData\Local\Programs\Python\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (node:child_process:397:12)
gyp ERR! stack at ChildProcess.emit (node:events:394:28)
gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "G:\\qtadmin\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd G:\qtadmin\node_modules\node-sass
gyp ERR! node -v v16.5.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules\watchpack\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchpack-chokidar2\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.3 (node_modules\sane\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\webpack-dev-server\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @babel/helper-define-polyfill-provider@0.3.0 requires a peer of @babel/core@^7.4.0-0 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.14.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
出现这样的报错该如何解决,请大佬们给个解决方法 是不是Python的版本不对?看你用的3.9,是不是需要Python2才行? node.js与系统的python版本冲突 更换python版本,2.x的试试 深巷丶 发表于 2021-11-19 15:35
是不是Python的版本不对?看你用的3.9,是不是需要Python2才行?
试过python2.7也不行 howyouxiu 发表于 2021-11-19 15:35
更换python版本,2.x的试试
node和python版本都降级了,也不行 目前的python降级为2.7,node版本是16.5,npm降级为6.14
经测试都不行解决问题 你打开cmd,输入python ,看看默认是不是3.x版本的,如果是就想办法把python命令默认改成2.x的 howyouxiu 发表于 2021-11-19 15:42
你打开cmd,输入python ,看看默认是不是3.x版本的,如果是就想办法把python命令默认改成2.x的
之前降级为python2.7版本,并配置了环境变量,也没能解决 lifeixue 发表于 2021-11-19 15:44
之前降级为python2.7版本,并配置了环境变量,也没能解决
报错原因就是python解释器问题,3.x解释器不支持2.x语法。虽然你之前降为2.7并配置了环境,但是默认python解释器可能还是3.x的,所以还是报错,我建议可以先删除3.x的环境变量,只留2.7的,用完再还原
页:
[1]
2