我有一个 discord.js 机器人,它在 Heroku 上运行。我刚刚添加了画布,现在机器人无法构建。
这是日志:
-----> Installing dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
> canvas@2.6.1 install /tmp/build_c8ad4f45_/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.uZg6i/_logs/2021-01-01T17_53_37_239Z-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
我已经按照日志的建议安装了 node-pre-gyp,没有任何改变。这是 package.json:
{
"dependencies": {
"canvas": "^2.6.1",
"discord.js": "^12.4.1",
"dotenv": "^8.2.0",
"firebase": "^8.1.1",
"firebase-admin": "^9.4.1",
"node-pre-gyp": "^0.11.0"
}
}
有谁知道解决这个问题?