gpt4 book ai didi

node.js - 运行 npm install 给我这些错误

转载 作者:行者123 更新时间:2023-12-02 16:12:32 24 4
gpt4 key购买 nike

我尝试了很多方法来解决这个问题,但找不到解决方案,安装的 node sass 只是增加了更多问题,它以前运行没有问题,现在我不断收到错误

npm ERR! code 1
npm ERR! path D:\sb-app\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe D:\sb-app\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli 'D:\\sb-app\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.2.0 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (D:\sb-app\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (D:\sb-app\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (D:\sb-app\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:194:21)
npm ERR! gyp verb `which` failed python2 Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (D:\sb-app\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (D:\sb-app\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (D:\sb-app\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:194:21) {
npm ERR! gyp verb `which` failed code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python C:\Python39\python.EXE
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:326:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:365:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\sb-app\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd D:\sb-app\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.2.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ionutz\AppData\Local\npm-cache\_logs\2021-05-21T08_51_40_333Z-debug.log

我不知道该怎么做我也尝试安装 node-sass 但没有成功

最佳答案

npm 错误有时会非常(可以说是过于)冗长。错误的有趣部分是:

npm ERR! gyp verb check python checking for Python executable "python2" in the PATH

您尝试安装的包有一个使用 gyp 在本地编译的 native 部分,作为其工具的一部分,npm 需要 python2 来执行构建。
您需要确保安装了 python2,并且可执行文件是路径的一部分。

或者,如果你安装了 python 但它的命名不同,你可以通过调用告诉 npm 使用什么可执行文件

npm config set python /path/to/your/python

关于node.js - 运行 npm install 给我这些错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67633906/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com