微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将 web3 应用程序部署到 heroku 时找不到 node-gyp-build

如何解决将 web3 应用程序部署到 heroku 时找不到 node-gyp-build

我正在尝试将 web3 应用程序部署到 heroku,但是在构建 npm 依赖项时,我收到以下错误

remote: sh: 1: node-gyp-build: not found
remote: npm ERR! code ELIFECYCLE                                                                                                  
remote: npm ERR! syscall spawn                                                                                                    
remote: npm ERR! file sh                                                                                                          
remote: npm ERR! errno ENOENT                                                                                                     
remote: npm ERR! bufferutil@4.0.3 install: `node-gyp-build`                                                                       
remote: npm ERR! spawn ENOENT                                                                                                     
remote: npm ERR!                                                                                                                  
remote: npm ERR! Failed at the bufferutil@4.0.3 install script. 

我相信这是因为我添加了 web3@1.3.6 依赖项。如果我在 package.json 文件中的 npm 依赖项中忽略了这一点,部署将成功运行。

如果我通过 ssh 进入控制台,我可以运行 npm install -g web3@1.3.6 并且这也是成功的。我还尝试在 package.json 文件添加 node-gyp、node-gyp-build 和 bufferutil 作为显式依赖项。我正在使用

node 14.17.0 npm 6.14.13 python 3.9.5

以下是我的完整 package.json 文件

{
  "engines": {
    "node": "14.17.0","npm": "6.14.13"
  },"repository": {},"description": " ","license": "MIT","scripts": {
    "deploy": "webpack --mode production","watch": "webpack --mode development --watch"
  },"dependencies": {
    "postcss": "8.1.0","@popperjs/core": "^2.9.2","bootstrap": "^5.0.1","jquery": "^3.6.0","phoenix": "file:../deps/phoenix","phoenix_html": "file:../deps/phoenix_html","phoenix_live_view": "file:../deps/phoenix_live_view","topbar": "^0.1.4","@babel/core": "^7.0.0","babel-polyfill": "^6.26.0","@babel/preset-env": "^7.0.0","babel-loader": "^8.0.0","css-loader": "^5.2.6","sass-loader": "^10.0.0","node-sass": "^6.0.0","cropperjs": "1.5.12","eth-sig-util": "^1.4.2","jquery-cropper": "1.0.1","copy-webpack-plugin": "^5.1.1","hard-source-webpack-plugin": "^0.13.1","mini-css-extract-plugin": "^0.9.0","optimize-css-assets-webpack-plugin": "^5.0.1","terser-webpack-plugin": "^2.3.2","webpack": "^4.41.5","webpack-cli": "^3.3.2","web3": "1.3.6"
  },"devDependencies": {},}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。