一开始 npm 构建没问题,一直用到现在,今天构建的时候看到了更新信息,更新之后就出现广告错误。
我有一个答案,重新安装python2.7
sudo apt install python2
并且成功了。那么 npm build 应该绑定到 2.7 吗?
有没有办法同时使用 python3 进行构建?
我该如何解决这个问题?
谢谢阅读。
npm install -g npm // update
npm --version
>> 8.12.1
whereis python
>> python: /usr/bin/python3.8 /usr/lib/python3.8 /usr/lib/python3.9 /usr/lib/python2.7 /etc/python3.8 /etc/python2.7 /usr/local/lib/python3.8
npm config set python "usr/bin/python3"
sudo npm run build
> [email protected] build
> node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp ERR! configure error
gyp ERR! stack Error: Command failed: /usr/bin/python3 -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 (child_process.js:383:12)
gyp ERR! stack at ChildProcess.emit (events.js:400:28)
gyp ERR! stack at maybeClose (internal/child_process.js:1088:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
gyp ERR! System Linux 5.4.0-113-generic
gyp ERR! command "/usr/bin/node" "/home/worlture/node_s/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/worlture/node_s
gyp ERR! node -v v14.19.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok