我需要做啥来修复我的 Heroku 构建?
Posted
技术标签:
【中文标题】我需要做啥来修复我的 Heroku 构建?【英文标题】:What do I need to do to fix my Heroku build?我需要做什么来修复我的 Heroku 构建? 【发布时间】:2021-01-03 13:35:59 【问题描述】:我的 Heroku 构建失败。我已经尝试了很多东西,请帮助。
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 12.x...
Downloading and installing node 12.18.4...
Using default npm version: 6.14.6
-----> Restoring cache
- node_modules is checked into source control and cannot be cached
-----> Installing dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
> canvas@2.6.1 install /tmp/build_3773cfd3_/node_modules/canvas
> node-pre-gyp install --fallback-to-build
sh: 1: node-pre-gyp: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! canvas@2.6.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the canvas@2.6.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.Fsis9/_logs/2020-09-16T16_51_53_694Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- node_modules checked into source control
https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
我不知道它为什么会失败,但我真的希望它能够工作。任何帮助表示赞赏。如果您需要更具体的细节,请告诉我!我正在制作不和谐机器人,但它不适用于 heroku。我的联系人:
Discord: MirroxGame#5150
邮箱:zyuzin.ivan08@gmail.com
我的 package.json:
"name": "discordbot",
"version": "1.0.0",
"description": "DiscordBot",
"main": "main.js",
"scripts":
"prod:start": "pm2-runtime app.js"
,
"author": "User",
"license": "ISC",
"dependencies":
"canvas-senpai": "^0.1.6",
"discord.js": "^12.3.1",
"npm": "^6.14.8",
"quick.db": "^7.1.1",
"random-puppy": "^1.1.0"
【问题讨论】:
【参考方案1】:检测到预构建(node_modules 已存在)
不要上传“node_modules”。
package.json 和 package-lock.json 只应该上传。然后 Heroku 会自动安装所有依赖项。
【讨论】:
以上是关于我需要做啥来修复我的 Heroku 构建?的主要内容,如果未能解决你的问题,请参考以下文章
Heroku 需要配置啥来处理基于 CoffeeScript 的模板?
如何修复页面 ChunkLoadError:加载块 0 failed.in nuxtjs + heroku?
停止 Heroku 运行 npm start + 运行啥来代替?
如何修复 Heroku 上的 ActionDispatch::Cookies::CookieOverflow 错误?