【发布时间】:2021-06-01 07:56:39
【问题描述】:
我需要 Heroku 使用 NodeJS 14 而不是 12,我该怎么做?在我的计算机上,我使用的是节点 14,我在 package.json 的引擎中定义它(在我的仓库的根目录):
{
"engines": {
"node": "14.x"
}
...
}
我同时安装了 heorku/nodejs 和 heroku/rails buildpack,因为这是一个带有 webpack 的 Ruby on Rails 应用程序:
但是当我的测试是 Heroku 时,我得到了这个错误:
Error: Missing binding /app/node_modules/node-sass/vendor/linux-x64-72/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 12.x
Found bindings for the following environments:
- Linux 64-bit with Unsupported runtime (88)
如果我在 CI 中解决问题,我在部署时仍然会遇到问题:
-----> Installing node-v12.16.2-linux-x64
-----> Installing yarn-v1.22.4
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
yarn install v1.22.4
[1/5] Validating package.json...
error imok@0.1.0: The engine "node" is incompatible with this module. Expected version "14.x". Got "12.16.2"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
【问题讨论】:
-
嗨,为了确定,你能显示
heroku buildpacks命令的结果吗? -
您是否可能需要多个构建包(节点 && rails):devcenter.heroku.com/articles/…
-
@VictorBls 我没有安装 heroku cli,如果你在 buildpacks 列表之后,我有 heroku/ruby 和 heroku/nodejs。我将在问题中添加详细信息。
-
@RobertRowntree:是的,我需要并且我有多个构建包,heroku/ruby 和 heroku/nodejs。这是我问题的结尾。我会澄清的。
-
问题在于构建包的添加顺序。 Glen 找到了解决方案。