如何在heroku [Node.js]上部署/运行canvas

问题描述

我用node.js创建了一个不和谐的机器人,它使用一个名为canvas的npm运行2.6.1版,但是当我不打算将文件推送到github并进行部署时,我总是遇到错误。如果有帮助,我将运行一个buildpack,这是认的node.js。

-----> Node.js app detected
       
-----> 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.3
       Using default npm version: 6.14.6
       
-----> Installing dependencies
       Prebuild detected (node_modules already exists)
       Rebuilding any native modules
       
       > [email protected] install /tmp/build_3c59f676_/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! [email protected] install: `node-pre-gyp install --fallback-to-build`
       npm ERR! Exit status 126
       npm ERR! 
       npm ERR! Failed at the [email protected] 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.AGHnL/_logs/2020-08-11T12_04_57_845Z-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

任何原因以及如何解决此问题?我已经为此奋斗了大约一个小时左右。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)