我正在努力将新的 Rails 6 应用程序部署到 Heroku。它在我本地运行良好。在部署过程中,我收到以下输出。
不幸的是,我对 webpack 和 Yarn 还很陌生。这似乎是 move-file 的版本/依赖关系问题,而 move-file 又似乎是 webpacker 的依赖关系。但是,我不知道如何解决这个问题。
似乎可以归结为这一行:
error [email protected] /cdn-cgi/l/email-protection: The engine "node" is incompatible with this module. Expected version ">=10.17". Got "10.15.3"
但是,节点不是我的节点模块之一,但似乎是已安装的二进制文件。当我跑步时
node - v
我得到:v12.16.1
任何帮助将不胜感激。
remote: Removing bundler (2.0.2)
remote: Bundle completed (201.39s)
remote: Cleaning up the bundler cache.
remote: -----> Installing node-v10.15.3-linux-x64
remote: -----> Installing yarn-v1.16.0
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: yarn install v1.16.0
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: info [email protected] /cdn-cgi/l/email-protection: The platform "linux" is incompatible with this module.
remote: info "[email protected] /cdn-cgi/l/email-protection" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: error [email protected] /cdn-cgi/l/email-protection: The engine "node" is incompatible with this module. Expected version ">=10.17". Got "10.15.3"
remote: error Found incompatible module.
remote: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
如果您需要任何进一步的日志或代码示例,请告诉我。我很茫然。
=====================
更新:
我在heroku上找到了有关buildpacks和node的文档:
-https://devcenter.heroku.com/articles/nodejs-support https://devcenter.heroku.com/articles/nodejs-support
基于此,我将 package.json 文件更改为如下所示:
},
"version": "0.1.0",
"engines": {
"node": "12.16.x"
},
"devDependencies": {
"webpack-dev-server": "^3.10.3"
}
现在,错误消息已更改为:
remote: Running: rake assets:precompile
remote: yarn install v1.16.0
remote: [1/5] Validating package.json...
remote: error [email protected] /cdn-cgi/l/email-protection: The engine "node" is incompatible with this module. Expected version "12.16.x". Got "10.15.3"
remote: error Found incompatible module.
remote: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
我假设 package.json 文件中的更新会导致 heroku 使用指定的节点版本。然而,事实并非如此。
问题是:如何定义heroku 使用哪个节点版本?