如何解决npm 错误!:代码 127gyp 错误!堆栈错误:命令失败
我在执行 npm install
时遇到以下错误:
$ npm install
npm ERR! code 127
npm ERR! path /home/jesusjimenez/projects/project/node_modules/fibers
npm ERR! command failed
npm ERR! command sh -c node build.js || nodejs build.js
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@15.12.0 | linux | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: /usr/bin/python3 -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:369:20)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
npm ERR! gyp ERR! stack at Socket.<anonymous> (node:internal/child_process:453:11)
npm ERR! gyp ERR! stack at Socket.emit (node:events:369:20)
npm ERR! gyp ERR! stack at Pipe.<anonymous> (node:net:665:12)
npm ERR! gyp ERR! System Linux 5.8.0-48-generic
npm ERR! gyp ERR! command "/usr/bin/node" "/home/jesusjimenez/projects/project/node_modules/.bin/node-gyp" "rebuild" "--release"
npm ERR! gyp ERR! cwd /home/jesusjimenez/projects/project/node_modules/fibers
npm ERR! gyp ERR! node -v v15.12.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! node-gyp exited with code: 1
npm ERR! Please make sure you are using a supported platform and node version. If you
npm ERR! would like to compile fibers on this machine please make sure you have setup your
npm ERR! build environment--
npm ERR! Windows + OS X instructions here: https://github.com/nodejs/node-gyp
npm ERR! Ubuntu users please run: `sudo apt-get install g++ build-essential`
npm ERR! RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
npm ERR! Alpine users please run: `sudo apk add python make g++`
npm ERR! sh: 1: nodejs: not found
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jesusjimenez/.npm/_logs/2021-03-30T21_32_02_097Z-debug.log
我不完全确定是什么破坏了安装,如果光纤或以某种方式那个 python SyntaxError: invalid syntax
但是,尝试单独安装光纤会引发相同的错误。 npm i -g fibers
不会修复,也不会改变 npm configure set python /path/to/python
。暂时删除纤程会不断抛出相同的 Python SyntaxError: invalid syntax
错误,这次是使用另一个 node_module。
解决方法
我遇到了相同/类似的问题,但没有对 node.js 版本进行任何更改。我讨厌成为那个人,但经过一天的挣扎后,我决定重新启动我的机器。解决了它...
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。