当前位置: 首页 > 知识库问答 >
问题:

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

云育
2023-09-10

大家在安装仓库依赖时是否遇到过 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 586msnode_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 561msnode_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 的官方仓库,但一直下载不好依赖,求助 ����

共有1个答案

尉迟清野
2023-09-10

找到原因了,不清楚啥时候在全局的 .npmrc 配置文件中添加了 tarball 参数:

tarball=/tmp/node-v14.17.6-headers.tar.gz

把这个配置去掉即可,还有就是使用 yapi 官方推荐的 node 版本,我使用了 v7.10.1(太老了��)可以跑起来。

相关链接:https://stackoverflow.com/questions/42722457/how-to-prevent-node-gyp-from-downloading-node-headers-tar-gz-and-node-lib-from-i

 类似资料:
  • npminstall Make npm install fast and handy. Use as Cli Install $ npm install npminstall -g Usage In cnpm It is integrated in cnpm. $ npm install cnpm -g$ cnpm install // will use npminstall npminstal

  • 书上说这段代码在目录被glob匹配的情况下(如node_modules/fs.stat)应该报错,但是我在本地执行没有。 下面代码实现了一个copy的功能,将source directory下的所有文件复制到destination directory。 对这段代码的几点说明: 此处的glob版本为7.2.3,最新版本的glob是基于promise的,不再支持回调。 fs-extra提供了更多的功能

  • 出于某种原因,我需要使用自己的苹果的开发者账号重新给node.js 签名。 使用了命令 codesign --deep --timestamp --options runtime -f -s 'Developer ID Application: xxxxxxxx' ~/Library/Keychains/login.keychain-db node 重新签名了node. 但是,执行签名后的node

  • 当执行 this.write 报错的时候,catch到错误以后还生成了 filename 这个文件,这里能有什么设置可以让出错的时候不生成文件,我现在只有加上 fs.unlink去手动删除。

  • 本文向大家介绍Windows安装Node.js报错:2503、2502的解决方法,包括了Windows安装Node.js报错:2503、2502的解决方法的使用技巧和注意事项,需要的朋友参考一下 前言 Windows真的是太恶心了!!!不仅会出现大量的垃圾文件,而且有时莫名的安装不上一些软件(正常软件)。前久因为想学学Koa2,打算升级下nodejs的版本以体验下ES6、ES7的aync,awai

  • 问题内容: 我正在尝试创建一个node.js应用程序, 导致我的程序崩溃。节点说 ReferenceError:警报未定义 然后退出。我可以在常规html页面上运行javascript时使用该函数,因此我不知所措,这是为什么…这是我必须与node.js一起使用的单独模块吗? 问题答案: 该功能是浏览器对象的属性。它实际上不是JavaScript的一部分;它只是该环境中JavaScript代码可用的

  • 使用@clickhouse/client-web本地是正常的, 到测试环境就报错crypto.randomUUID is not a function node版本18.多,依赖已安装上,搜索的方法也已经试过,没有效果,这是什么原因呢?

  • 本文向大家介绍node.js缺少mysql模块运行报错的解决方法,包括了node.js缺少mysql模块运行报错的解决方法的使用技巧和注意事项,需要的朋友参考一下 发现问题 在用node.js连接数据库,运行报错:cannot find module 'mysql; 然后 在管理员和用户下分别用npm安装数据库但是都是失败: 解决方法 按照错误日志应该是找不到文件夹,无法打开package.jso