RubyMine 的运行配置导致“Yarn 需要 Node.js 4.0"的错误;在 Ubuntu 上 [英] RubyMine's run config results in error that "Yarn requires Node.js 4.0" on Ubuntu

查看:23
本文介绍了RubyMine 的运行配置导致“Yarn 需要 Node.js 4.0"的错误;在 Ubuntu 上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 Elementary OS 机器(基于 Ubuntu 的操作系统)上,使用 rails new yarntest 创建新的 Ruby on Rails 项目并将其加载到 RubyMine 后,我无法使用 RubyMine 的Development"启动它:yarntest"运行配置.输出是:

On my Elementary OS machine (an Ubuntu-based OS), after creating a new Ruby on Rails project with rails new yarntest and loading it in RubyMine, I could not launch it with RubyMine's "Development: yarntest" run configuration. The output was:

=> Booting Puma
=> Rails 6.0.1 application starting in development 
=> Run `rails server --help` for more startup options
Yarn requires Node.js 4.0 or higher to be installed.


========================================
  Your Yarn packages are out of date!
  Please run `yarn install --check-files` to update.
========================================


To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).

但是,在控制台中运行 rails server 是可行的.

However, running rails server in the console worked.

我尝试了重新安装 Yarn,但还是不行.

I tried reinstalling Yarn, but it still did not work.

我只能禁用 Ruby on Rails 配置中的 Yarn 完整性检查 如错误消息中所述(删除 yarn.lock 似乎也有效,但肯定是错误的).同样,我不想追踪和删除不同的 Yarn 版本,正如 对另一个问题的建议,因为问题是使用 RubyMine.

I could only disable the Yarn integrity check in the Ruby on Rails config as stated in the error message (deleting the yarn.lock also appeared to work, but is surely wrong). Similarly, I did not want to track down and remove the different Yarn version, as suggested on another question, since the issue was with RubyMine.

推荐答案

我在 answer 上遇到了一个answer="https://stackoverflow.com/q/50078826/3287963">另一个问题在运行 sudo yarn install(即在 sudo 模式下)时提到了此错误消息.我尝试运行 sudo yarn install 并且最终可以在 RubyMine 的运行配置之外重现错误消息.显然,在 sudo 模式下运行时,yarn 二进制文件已过时.

I came across an answer on another question that mentioned this error message when running sudo yarn install (i. e. in sudo mode). I tried running sudo yarn install and could finally reproduce the error message outside of RubyMine's run config. Apparently, when running in sudo mode, the yarn binary was outdated.

因此,解决方案是将 RubyMine 指向正确的 yarn 二进制文件.

The solution is therefore to point RubyMine to the correct yarn binary.

最简单的方法是使用 rubymine 从终端启动 RubyMine,如 由奥利维亚指出.请参阅相关的 JetBrains 票.

The easiest way to do that is to launch RubyMine from the terminal with rubymine, as pointed out by Olivia. See the related JetBrains ticket.

这篇关于RubyMine 的运行配置导致“Yarn 需要 Node.js 4.0"的错误;在 Ubuntu 上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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