尝试执行rails命令时与spring相关的错误

Got*_*tey 4 spring ruby-on-rails

我创建了一个新的 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.
Run Code Online (Sandbox Code Playgroud)

我目前有

spring -v
Spring version 2.1.0
Run Code Online (Sandbox Code Playgroud)

我尝试过以下方法,得到相同的结果。我也尝试卸载spring并重新安装。

 bundle exec spring binstub --all
* bin/rake: Spring already present
* bin/rails: Spring already present
Run Code Online (Sandbox Code Playgroud)

小智 9

在尝试了所有其他相关解决方案后,将此作为答案发布,最终发现隐藏在评论中。希望它对将来的人有所帮助。

\n

至于原因,我认为唯一的原因是从 ubuntu (pop os) 20.04 升级到 20.10。在我的两次编码会话之间没有做任何其他事情。

\n
\n

我已经尝试过该帖子中的指示,但仍然不起作用。不知何故\n运行gem pristine --all解决了问题,但不确定为什么 \xe2\x80\x93\nGotey Jan 3 at 14:05

\n
\n