安装npm时出错

2024-05-19 23:25:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图将npm和节点模块安装到我的项目中,这是我得到的错误

npm ERR! code 1

npm ERR! path /home/muca/Documents/hoodty/hoodty-web/node_modules/deasync

npm ERR! command failed

npm ERR! command sh -c node ./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@16.4.1 | linux | x64

npm ERR! gyp ERR! configure error 

npm ERR! gyp ERR! stack Error: Command failed: /usr/bin/python -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:397:12)

npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:394: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 Linux 5.9.16-1-MANJARO

npm ERR! gyp ERR! command "/usr/local/bin/node" 

"/home/muca/Documents/hoodty/hoodty-web/node_modules/.bin/node-gyp" "rebuild"

npm ERR! gyp ERR! cwd /home/muca/Documents/hoodty/hoodty-web/node_modules/deasync

npm ERR! gyp ERR! node -v v16.4.1

npm ERR! gyp ERR! node-gyp -v v3.8.0

npm ERR! gyp ERR! not ok 

npm ERR! Build failed

Tags: infomoduleswebnodehomenpmstacksys