纱线安装说是最新的,但无法启动rails控制台

Max*_*tov 13 ruby-on-rails webpack ruby-on-rails-5 yarnpkg

我一直在使用Webpack,Vue.js和Rails开发一个应用程序.两个月没有问题,但是当我尝试启动rails console时无处不在rails c,yarn抱怨包已过时:

error An unexpected error occurred: "Unknown language key integrityNodeDoesntMatch".
info If you think this is a bug, please open a bug report with the information provided in "/Users/maksimfedotov/vras/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.


========================================
  Your Yarn packages are out of date!
  Please run `yarn install` to update.
========================================
Run Code Online (Sandbox Code Playgroud)

然而,当我跑yarn install:

yarn install v1.3.2
[1/4]   Resolving packages...
success Already up-to-date.
?  Done in 0.71s.
Run Code Online (Sandbox Code Playgroud)

我一直在查看yarn和webpacker文档,尝试了各种yarn清理命令,但没有运气.

有趣的是,我仍然可以运行服务器,它唯一抱怨的控制台.

luc*_*cas 14

尝试通过运行重新启动 spring spring stop

这为我解决了这个问题,意味着我不需要经常使用 spring 禁用标志为命令添加前缀。

上面的命令停止 spring: 要检查它是否自动重新启动,请运行spring status.

感谢在GitHub此评论的解决方案!


Max*_*tov 7

This is an old issue, which has been resolved, so I am writing down what I did in the end:

Simply deleting node_modules usually solves the issue. If you are using spring, it also can mess this up, so consider running DISABLE_SPRING=1 rails s to see if that helps


anq*_*egi 5

您可以添加在config/environments/development.rb

此配置设置

config.webpacker.check_yarn_integrity = false
Run Code Online (Sandbox Code Playgroud)

它还忘记在开发环境中检查每个 Rails 调用的纱线完整性,例如迁移、启动控制台......