通过Heroku部署Rails应用程序使用旧版本的Node [英] Deploying Rails App via Heroku uses an old version of Node

查看:18
本文介绍了通过Heroku部署Rails应用程序使用旧版本的Node的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在我的Ubuntu 16.04计算机上通过Heroku;Git Push Heroku MASTER&部署我的Rails应用程序时,收到以下错误:

[2/4] Fetching packages...
remote:          error @rails/webpacker@4.2.2: The engine "node" is incompatible with this module. Expected version ">=8.16.0".
remote:        error An unexpected error occurred: "Found incompatible module".
remote:        info If you think this is a bug, please open a bug report with the information provided in "/tmp/build_c472d4366cfa53133fe29a2426a45a7b/yarn-error.log".
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文件(在根文件夹中):

{
  "name": "site",
  "private": true,
  "dependencies": {
    "@rails/webpacker": "4.2.2",
    "flatpickr": "^4.6.3",
    "jquery": "^3.3.1",
    "node": "^12.x",
    "node-sass": "^4.13.1",
    "reading-time": "^1.2.0",
    "simple-lightbox": "^2.1.0"
  },
  "devDependencies": {
    "@babel/plugin-syntax-dynamic-import": "^7.8.3",
    "webpack-cli": "^3.3.11",
    "webpack-dev-server": "^3.10.3"
  }
}

节点--版本:

v13.10.1

Heroku运行节点--版本:

Running node --version on ⬢ -site... up, run.4229 (Hobby)
v12.16.1

推荐答案

不确定具体是什么,但该问题与我使用的Heroku构建包有关(heroku-Buildpack-bundler2)

以下是我为解决这个问题所做的:

$ heroku buildpacks:set heroku/ruby
$ heroku buildpacks:add --index 1 heroku/nodejs

$ git push heroku master

现在一切正常:-)

这篇关于通过Heroku部署Rails应用程序使用旧版本的Node的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆