Ruby:没有这样的文件要加载 - 咖啡/铁路

时间:2021-10-01 09:47:47

I am a ruby novice.I created my first ruby on rails application which named "HelloRubyWeb" on my mac.Then "cd HelloRuby",But when I input the command "rails s" ,it returned the error log:

我是一个ruby新手。我在我的mac上创建了我的第一个ruby on rails应用程序,名为“HelloRubyWeb”。然后“cd HelloRuby”,但是当我输入命令“rails s”时,它返回了错误日志:

 /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:74:in `require': no such file to load -- coffee/rails (LoadError)
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:74:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler.rb:119:in `require'
from /Users/admin/Ruby/HelloRuby/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.2.7/lib/rails/commands.rb:53:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.7/lib/rails/commands.rb:53
from /Library/Ruby/Gems/1.8/gems/railties-3.2.7/lib/rails/commands.rb:50:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.7/lib/rails/commands.rb:50
from script/rails:6:in `require'
from script/rails:6

Can any one help me? Very thanks.

谁能帮我?很感谢。

2 个解决方案

#1


1  

kasperite is probably right, in the terminal run:

kasperite可能是正确的,在终端运行中:

bundle then run rails s

捆绑然后运行rails s

Post the errors you get if any.

发布您获得的错误(如果有)。

#2


0  

I had the same issue, but in my case it was because of the explicit coffee-rails version.

我有同样的问题,但在我的情况下,这是因为明确的coffee-rails版本。

1) remove strictly set version for coffee-rails gem in Gemfile

1)删除Gemfile中coffee-rails gem的严格设置版本

2) run bin/bundle

2)运行bin / bundle

3) run bin/bundle update

3)运行bin / bundle更新

4) run bin/rails s

4)运行bin / rails s

If you need explicitly set working version, just run bin/bundle show 'coffee-rails' and copy the version number from the terminal.

如果您需要明确设置工作版本,只需运行bin / bundle show'coffee-rails'并从终端复制版本号。

#1


1  

kasperite is probably right, in the terminal run:

kasperite可能是正确的,在终端运行中:

bundle then run rails s

捆绑然后运行rails s

Post the errors you get if any.

发布您获得的错误(如果有)。

#2


0  

I had the same issue, but in my case it was because of the explicit coffee-rails version.

我有同样的问题,但在我的情况下,这是因为明确的coffee-rails版本。

1) remove strictly set version for coffee-rails gem in Gemfile

1)删除Gemfile中coffee-rails gem的严格设置版本

2) run bin/bundle

2)运行bin / bundle

3) run bin/bundle update

3)运行bin / bundle更新

4) run bin/rails s

4)运行bin / rails s

If you need explicitly set working version, just run bin/bundle show 'coffee-rails' and copy the version number from the terminal.

如果您需要明确设置工作版本,只需运行bin / bundle show'coffee-rails'并从终端复制版本号。