Node.js 如何让Heroku使用节点14.x而不是12.x?
我需要Heroku使用NodeJS 14而不是12,我该怎么做?在我的计算机上,我使用节点14,并在Node.js 如何让Heroku使用节点14.x而不是12.x?,node.js,heroku,Node.js,Heroku,我需要Heroku使用NodeJS 14而不是12,我该怎么做?在我的计算机上,我使用节点14,并在package.json(在我的repo的根目录下)的引擎中定义它: 我安装了heorku/nodejs和heroku/railsbuildpack,因为这是一个带有网页包的Ruby on rails应用程序: 但在Heroku运行我的测试时,我得到以下错误: Error: Missing binding /app/node_modules/node-sass/vendor/linux-x64-
package.json
(在我的repo的根目录下)的引擎中定义它:
我安装了heorku/nodejs
和heroku/rails
buildpack,因为这是一个带有网页包的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.
信中说:
如果您的Ruby应用程序需要特定版本的node,您应该使用多个构建包首先安装node,然后安装Ruby
这意味着,如果您部署了Rails应用程序,您需要删除所有构建包,然后按照正确的顺序重新添加它们,首先是
heroku/node
,然后是heroku/Rails
,嗨,可以确定的是,您能否显示heroku buildpacks
命令的结果?您可能需要多个构建包吗(节点和轨道):@VictorBls我没有安装heroku cli,如果你在查看构建包列表,我有heroku/ruby和heroku/nodejs。我会在问题中添加详细信息。@RobertRowntree:是的,我需要并且我有多个构建包,heroku/ruby和heroku/nodejs。这是我问题的结尾。我会澄清。问题是构建包的顺序添加了LDPACK。格伦找到了解决方案。
-----> 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.