在heroku上使用vue应用程序部署rails 6时出现node-gyp错误

Posted

技术标签:

【中文标题】在heroku上使用vue应用程序部署rails 6时出现node-gyp错误【英文标题】:node-gyp error while depoloying rails 6 with vue app on heroku 【发布时间】:2020-10-12 03:36:32 【问题描述】:

我正在尝试在 heroku 上使用 vue 应用程序部署 rails 6,但出现此错误:

[4/4] Building fresh packages...
   error /tmp/build_c242c7d78580af478535f5a344ff701e/node_modules/fibers: Command failed.
   Exit code: 127
   Command: node build.js || nodejs build.js
   Arguments: 
   Directory: /tmp/build_c242c7d78580af478535f5a344ff701e/node_modules/fibers
   Output:
   node-gyp not found! Please ensure node-gyp is in your PATH--
   Try running: `sudo npm install -g node-gyp`
   /bin/sh: 1: nodejs: not found
   spawn node-gyp ENOENT
   info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

   Precompiling assets failed.

   Push rejected, failed to compile Ruby app.
   Push failed

我试图到处寻找解决方案,但似乎没有其他人遇到过这个问题。知道如何解决这个问题吗?谢谢

【问题讨论】:

【参考方案1】:

我没有将 node buildpack 添加到 heroku 应用程序,添加它解决了问题

【讨论】:

除此之外我必须在heroku/rails buildpack 之前移动它

以上是关于在heroku上使用vue应用程序部署rails 6时出现node-gyp错误的主要内容,如果未能解决你的问题,请参考以下文章