npm install 报错:gyp ERR! stack Error: ENOENT: no such file or directory ?

大家在安装仓库依赖时是否遇到过 node-gyp 报错的问题,错误信息大致如下:

node_modules/.pnpm/tree-sitter-json@0.20.0/node_modules/tree-sitter-json: Running install script, failed in 586ms
.../node_modules/tree-sitter-json install$ node-gyp rebuild
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@9.1.0
│ gyp info using node@16.19.1 | darwin | x64
│ gyp info find Python using Python version 3.8.10 found at "/Library/Frameworks/Python.framework/Versions/3.8/bin/python3"
│ gyp WARN install got an error, rolling back install
│ gyp ERR! configure error 
│ gyp ERR! stack Error: ENOENT: no such file or directory, stat '/tmp/node-v14.17.6-headers.tar.gz'
│ gyp ERR! System Darwin 22.6.0
│ gyp ERR! command "/Users/wangminghui/.nvm/versions/node/v16.19.1/bin/node" "/usr/local/Cellar/pnpm/7.11.0/libexec/dist/node_modules/node-gyp/bin/node-gyp.js" 
│ gyp ERR! cwd /Users/wangminghui/Documents/xylink-projects/yapi/node_modules/.pnpm/tree-sitter-json@0.20.0/node_modules/tree-sitter-json
│ gyp ERR! node -v v16.19.1
│ gyp ERR! node-gyp -v v9.1.0
│ gyp ERR! not ok 
└─ Failed in 586ms
node_modules/.pnpm/tree-sitter-yaml@0.5.0/node_modules/tree-sitter-yaml: Running install script, failed in 561ms
.../node_modules/tree-sitter-yaml install$ node-gyp rebuild
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@9.1.0
│ gyp info using node@16.19.1 | darwin | x64
│ gyp info find Python using Python version 3.8.10 found at "/Library/Frameworks/Python.framework/Versions/3.8/bin/python3"
│ gyp WARN install got an error, rolling back install
│ gyp ERR! configure error 
│ gyp ERR! stack Error: ENOENT: no such file or directory, stat '/tmp/node-v14.17.6-headers.tar.gz'
│ gyp ERR! System Darwin 22.6.0
│ gyp ERR! command "/Users/wangminghui/.nvm/versions/node/v16.19.1/bin/node" "/usr/local/Cellar/pnpm/7.11.0/libexec/dist/node_modules/node-gyp/bin/node-gyp.js" 
│ gyp ERR! cwd /Users/wangminghui/Documents/xylink-projects/yapi/node_modules/.pnpm/tree-sitter-yaml@0.5.0/node_modules/tree-sitter-yaml
│ gyp ERR! node -v v16.19.1
│ gyp ERR! node-gyp -v v9.1.0
│ gyp ERR! not ok 
└─ Failed in 561ms
node_modules/.pnpm/fsevents@1.1.2/node_modules/fsevents: Running install script...
node_modules/.pnpm/node-sass@4.14.1/node_modules/node-sass: Running install script...
node_modules/.pnpm/react-slick@0.17.1_wcqkhtmu7mswc6yz4uyexck3ty/node_modules/react-slick: Running postinstall script...
 ELIFECYCLE  Command failed with exit code 1.

找不到 /tmp/node-v14.17.6-headers.tar.gz 文件,确实这个目录下没有这个文件,不清楚为啥要找这个目录下的压缩包,我用的 nvm 管理 node 版本,默认是 v14.17.6,但当前使用的是 v16.19.1,Mac环境。这个项目是 yapi 的官方仓库,但一直下载不好依赖,求助 🙏🙏

阅读 4.5k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题