npm install Parcel安装失败

问题描述 投票:0回答:1

在我的计算机上的 npm 项目中运行 npm install --save-dev Parcel 将返回以下日志:

npm WARN deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm ERR! code 1
npm ERR! path /Users/xxxxxx/Desktop/test/node_modules/@parcel/watcher
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | x64
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Command failed: /Users/xxxxxx/anaconda3/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:422:12)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
npm ERR! gyp ERR! stack     at Socket.<anonymous> (node:internal/child_process:457:11)
npm ERR! gyp ERR! stack     at Socket.emit (node:events:514:28)
npm ERR! gyp ERR! stack     at Pipe.<anonymous> (node:net:337:12)
npm ERR! gyp ERR! System Darwin 22.5.0
npm ERR! gyp ERR! command "/Users/xxxxxx/.nvm/versions/node/v20.9.0/bin/node" "/Users/xxxxxx/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/xxxxxx/Desktop/test/node_modules/@parcel/watcher
npm ERR! gyp ERR! node -v v20.9.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /Users/xxxxxx/.npm/_logs/2024-02-18T18_19_28_422Z-debug-0.log

不知道如何解决这个问题。我读过这可能是 svgo 的问题,我正在研究 node-gyp 可能的问题,但我仍然不确定如何解决这个问题。非常感谢任何帮助!

javascript npm npm-install parcel
1个回答
0
投票

您的节点在安装节点时似乎缺少一些工具。

尝试重新安装节点并选中复选框以安装必要的工具

或者您可以使用此命令来安装必要的工具

npm install --global windows-build-tools
© www.soinside.com 2019 - 2024. All rights reserved.