吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 883|回复: 11
收起左侧

[求助] npm install项目时报错,度娘也没能解决

[复制链接]
lifeixue 发表于 2021-11-19 15:29
本帖最后由 lifeixue 于 2021-11-19 15:31 编辑

npm install 命令后,报错信息如下:
[HTML] 纯文本查看 复制代码
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 [url=mailto:fsevents@2.3.2]fsevents@2.3.2[/url]: 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 [url=mailto:fsevents@1.2.13]fsevents@1.2.13[/url]: 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 [url=mailto:fsevents@1.2.13]fsevents@1.2.13[/url]: 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 [url=mailto:fsevents@1.2.13]fsevents@1.2.13[/url]: 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 [url=mailto:fsevents@1.2.13]fsevents@1.2.13[/url]: 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! [url=mailto:node-sass@4.14.1]node-sass@4.14.1[/url] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [url=mailto:node-sass@4.14.1]node-sass@4.14.1[/url] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


出现这样的报错该如何解决,请大佬们给个解决方法

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

深巷丶 发表于 2021-11-19 15:35
是不是Python的版本不对?看你用的3.9,是不是需要Python2才行?
从白嫖到不嫖 发表于 2021-11-19 15:35
howyouxiu 发表于 2021-11-19 15:35
 楼主| lifeixue 发表于 2021-11-19 15:38
深巷丶 发表于 2021-11-19 15:35
是不是Python的版本不对?看你用的3.9,是不是需要Python2才行?

试过python2.7也不行
 楼主| lifeixue 发表于 2021-11-19 15:38
howyouxiu 发表于 2021-11-19 15:35
更换python版本,2.x的试试

node和python版本都降级了,也不行
 楼主| lifeixue 发表于 2021-11-19 15:42
目前的python降级为2.7,node版本是16.5,npm降级为6.14
经测试都不行解决问题
howyouxiu 发表于 2021-11-19 15:42
你打开cmd,输入python ,看看默认是不是3.x版本的,如果是就想办法把python命令默认改成2.x的
 楼主| lifeixue 发表于 2021-11-19 15:44
howyouxiu 发表于 2021-11-19 15:42
你打开cmd,输入python ,看看默认是不是3.x版本的,如果是就想办法把python命令默认改成2.x的

之前降级为python2.7版本,并配置了环境变量,也没能解决
howyouxiu 发表于 2021-11-19 15:55
lifeixue 发表于 2021-11-19 15:44
之前降级为python2.7版本,并配置了环境变量,也没能解决

image.png
报错原因就是python解释器问题,3.x解释器不支持2.x语法。虽然你之前降为2.7并配置了环境,但是默认python解释器可能还是3.x的,所以还是报错,我建议可以先删除3.x的环境变量,只留2.7的,用完再还原
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-25 18:39

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表