我创建了一个新的 rails 应用程序文件夹,运行顺利。一旦进入这样的文件夹,运行任何类型的 rails 命令,如 rails s
会提示我:
You've tried to invoke Spring when it's already loaded (i.e. the Spring constant is defined).
This is probably because you generated binstubs with Spring 1.0, and you now have a Spring version > 1.0 on your system. To solve this, upgrade your bundle to the latest Spring version and then run `bundle exec spring binstub --all` to regenerate your binstubs. This is a one-time step necessary to upgrade from 1.0 to 1.1.
我目前有
spring -v
Spring version 2.1.0
我尝试了以下方法,得到相同的结果。我也尝试卸载 spring 并重新安装。
bundle exec spring binstub --all
* bin/rake: Spring already present
* bin/rails: Spring already present
最佳答案
在尝试所有其他相关解决方案以最终找到隐藏在评论中的问题后,将此作为答案发布。希望它可以帮助将来的某个人。
至于原因,我看到的唯一原因是从 ubuntu (pop os) 20.04 升级到 20.10。在我的两次编码 session 之间没有做任何其他事情。
I've tried the indications in that post and kept not working. Somehow running
gem pristine --all
solves the issue, but not sure why – Gotey Jan 3 at 14:05
关于ruby-on-rails - 尝试执行 rails 命令时与 spring 相关的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59579627/