部署到 Heroku 失败。移动文件与节点版本不兼容

2024-03-10

我正在努力将新的 Rails 6 应用程序部署到 Heroku。它在我本地运行良好。在部署过程中,我收到以下输出。

不幸的是,我对 webpack 和 Yarn 还很陌生。这似乎是 move-file 的版本/依赖关系问题,而 move-file 又似乎是 webpacker 的依赖关系。但是,我不知道如何解决这个问题。

似乎可以归结为这一行:

error [email protected] /cdn-cgi/l/email-protection: 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 [email protected] /cdn-cgi/l/email-protection: The platform "linux" is incompatible with this module.
remote:        info "[email protected] /cdn-cgi/l/email-protection" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        error [email protected] /cdn-cgi/l/email-protection: 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 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 [email protected] /cdn-cgi/l/email-protection: 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-binaries https://devcenter.heroku.com/articles/ruby-support#installed-binaries

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

部署到 Heroku 失败。移动文件与节点版本不兼容 的相关文章

  • 找不到模块:无法解析 @google-cloud/storage 上的“fs”

    得到Module not found Can t resolve fs 尝试从 GCP Storage 列出存储桶时出错 import Storage from google cloud storage const googleCloud
  • JavaScript - 类根据条件扩展

    事情是这样的 我有一个名为 A 的主课 我希望这个班级能够扩展 B 级 class A extends B 但事实上 我希望 B 类在特定条件下扩展 C D 或 E class B extends B1 or class B extends
  • 在使用 supertest 和 Node.js 的测试中,res.body 为空

    我正在测试 Node js API超级测试 https github com visionmedia supertest 我无法解释为什么res body对象超集返回为空 数据显示在res text对象 但不是res body 知道如何解决
  • 在 Rails 6 上定义 Secret_key_base 的正确方法是什么?

    正确的定义方式是什么secret key base既然我们已经有了每个环境的凭据 就可以在 Rails 6 上使用了吗 我的环境有变量SECRET KEY BASE但 Rails 并没有接受它 我尝试定义secret key base in
  • NodeJS 在目录中递归地哈希文件

    我能够实现目录中的递归文件遍历 即探索目录中的所有子目录和文件 为此我使用了answer https stackoverflow com questions 5827612 node js fs readdir recursive dire
  • Node.js“需要”其他文件而不需要命名空间

    我正在将代码库从 100 浏览器端切换为浏览器端和服务器端的混合 我发现的问题是 要让我的代码使用 node js 运行 我必须使用模块 为了将我的代码变成模块 需要对几乎所有代码进行巨大的重构 原因是在浏览器上 许多功能是跨文件使用的 而
  • isModified 并预保存 mongoose...Nodejs

    您好 我只想在密码更改时使用散列密码保存 因此我在预保存中使用了 isModified 函数 但即使我更改了密码 它也总是返回 false 我尝试这样做的原因是因为我不想在更改其他属性时更改并保存我的密码 router post chang
  • Grunt-browserify+mapify+coffeescript = 未通过相对路径找到模块

    我尝试让 grunt browserify 使用 Coffeescript 的相对路径 但当我尝试构建源代码时总是收到错误消息 gt gt Error module src app utils includeMixin not found
  • npm install 没有拉入 devDependency

    我有 npm v 1 2 32 当我跑步时 npm 安装 mongo migrate 它不安装 mongodb 这是一个 devDependency 我究竟做错了什么 虽然与这个问题没有直接关系 但有些人可能有兴趣知道如果环境变量NODE
  • Nginx - Heroku Docker - 是否可以在 Heroku 上运行 Nginx 作为反向代理

    我试图弄清楚如何使用 Nginx 在 Heroku 应用程序上构建反向代理 问题是 Heroku 似乎每个应用程序只接受一个容器 但我的应用程序系统至少会使用三个容器 一个用于 Nginx 一个用于我的应用程序前端 一个用于我的业务逻辑服务
  • 运行故事书时出错 - sh: 1: start-storybook: 未找到

    我运行时遇到错误故事书 即使是干净的安装 npm run storybook gt storybook media programmersedge New Volume devs demostorybook gt start storybo
  • Windows 10 中的 npm 安装错误( npm install -g angular-cli )

    node v v4 5 0 npm v 5 0 1 有人在 Windows 10 中安装 angular cli 时遇到过这种问题吗 请尝试以下操作 step 0 运行这个命令 npm uninstall g angular cli npm
  • Socket.io 与服务器离线连接

    如何检测服务器是否离线或由于其他原因无法连接 我的代码看起来像这样 this socket io connect connectionInfo reconnect false 它不会抛出任何错误 因此 try catch 子句不起作用 Us
  • 如何调试 Node.js 应用程序?

    如何调试 Node js 服务器应用程序 现在我主要使用警报调试打印语句如下 sys puts sys inspect someVariable 一定有更好的调试方法 我知道谷歌浏览器 http en wikipedia org wiki
  • 如何在 Alexa 中循环播放音频

    我正在为 Alexa 构建睡眠环境音频技能 我正在尝试循环播放音频 这样我就不必下载 10 小时版本的音频 如何让音频正常工作 我将其构建到将播放音频但不循环播放的位置 我已经在我的造雨者技能中解决了这个问题 https www amazo
  • Google API、drive.files.list 和仅返回子文件

    我正在使用 谷歌API https www npmjs com package googleapis NodeJS 中的库 我试图返回当前指定文件夹中的文件和文件夹列表 但我发现drive files list返回用户已被授予读取权限的所有
  • Heroku ENOENT:没有这样的文件或目录,stat '/app/build/index.html'

    我在 Heroku 中运行一个简单的测试站点时遇到问题 由于某种原因 当我希望它从 build 提供服务时 它试图从 app build 提供内容 错误 ENOENT 没有这样的文件或目录 stat app build index html
  • Sails.js - 如何更新嵌套模型

    attributes username type email validated by the ORM required true password type string required true profile firstname s
  • 如何上传文件 - sails.js

    我可以下载图像和 pdf 但无法下载文档文件 doc pptx odt 下载文档 doc pptx odt 时 仅将其下载为 ZIP XML 文件 我可以做什么 我在用着 填写上传文件文档 https github com balderda
  • 了解使用 Windows 本机 WPF 客户端进行 ADFS 登录

    我已经阅读了大量有关 ADFS 与 NodeJS Angular 或其他前端 Web 框架集成以及一般流程如何工作的文献 并通过 Auth0 Angular 起始代码构建了概念证明 但我不明白如何这可以与本机 WPF Windows 应用程

随机推荐