我需要 Heroku 使用 NodeJS 14 而不是 12,我该怎么做?在我的计算机上,我使用 Node 14,并且我在引擎中定义它package.json(在我的存储库的根目录下):
{
"engines": {
"node": "14.x"
}
...
}
Run Code Online (Sandbox Code Playgroud)
我安装了 buildpackheorku/nodejs和heroku/railsbuildpack,因为这是带有 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)
Run Code Online (Sandbox Code Playgroud)
如果我解决了 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.
Run Code Online (Sandbox Code Playgroud)