部署到Heroku失败.移动文件与节点版本不兼容 [英] Deploy to Heroku failed. move-file incompatible with node version
问题描述
我正在努力将新的Rails 6应用程序部署到heroku.它在我的本地计算机上运行良好.在部署过程中,我收到以下输出.
不幸的是,我是webpack和yarn的新手.似乎是移动文件的版本/依赖关系问题,而这又似乎是webpacker的依赖关系.但是,我不知道该如何解决.
似乎可以归结为这一行:
error move-file@2.0.0: 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 fsevents@1.2.13: The platform "linux" is incompatible with this module.
remote: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: error move-file@2.0.0: 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 >
基于此,我更改了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 jobpro@0.1.0: 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使用哪个节点版本?
为此进行了一些研究. Heroku可以为每个应用程序应用多个构建包.在这种情况下,顺序很重要.我指定先运行nodejs buidlpack,然后再运行ruby buildpack. 只有这样,package.json中的"engine"定义才会生效.如果使用ruby buildpack,则节点版本默认为10.15.3.但是,如果首先执行nodejs buildpack,它将安装package.json文件中指定的版本. https://devcenter.heroku.com/articles/ruby-support#installed-二进制文件
I am struggling to deploy a new rails 6 app to heroku. It runs fine on my local. During the deployment process I receive the following output.
Unfortunately, I am new to webpack and yarn. It seems like a version / dependency issue with move-file which in turn seems to be a dependency for webpacker. However, I have no idea how to resolve this.
It seems to come down to this line:
error move-file@2.0.0: The engine "node" is incompatible with this module. Expected version ">=10.17". Got "10.15.3"
However, node is not one of my node-modules but seems to be an installed binary. When I run
node - v
I get: v12.16.1
Any help would be greatly appreciated.
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 fsevents@1.2.13: The platform "linux" is incompatible with this module.
remote: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: error move-file@2.0.0: 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
If you need any further log or code samples, please let me know. I am at a loss.
===================== update:
I found the documentation about buildpacks and node on heroku: - https://devcenter.heroku.com/articles/nodejs-support
based on that, I changed my package.json file to look like this:
},
"version": "0.1.0",
"engines": {
"node": "12.16.x"
},
"devDependencies": {
"webpack-dev-server": "^3.10.3"
}
now, the error message has changed to:
remote: Running: rake assets:precompile
remote: yarn install v1.16.0
remote: [1/5] Validating package.json...
remote: error jobpro@0.1.0: 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
I assumed the update in the package.json file would cause heroku to use the specified node version. However, it doesn't.
The question is: How can I define which node version heroku uses?
It took some research to solve this. Heroku can apply multiple build packs per app. In that case, the order matters. I specified to run the nodejs buidlpack first and then the ruby buildpack. Only then will the "engine" definition in the package.json have an effect. If you use the ruby buildpack, the node version defaults to 10.15.3. However, if you execute the nodejs buildpack first, it will install the version specified in the package.json file. https://devcenter.heroku.com/articles/ruby-support#installed-binaries
这篇关于部署到Heroku失败.移动文件与节点版本不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!