运行rake db:migrate会出现“找不到任何源中的coffee-script-source-1.3.3”错误

时间:2012-09-03 07:19:11

标签: ruby-on-rails ruby rake bundler

我刚刚创建了一个新的Rails应用程序(Rails v3.2.8)并尝试通过一次迁移运行rake db:migrate,但我总是收到此错误:

Could not find coffee-script-source-1.3.3 in any of the sources
Run `bundle install` to install missing gems.

但是,当我运行bundle install时,它表示已经安装了coffee-script-source-1.3.3:

Using rake (0.9.2.2) 
Using i18n (0.6.1) 
Using multi_json (1.3.6) 
....
Using coffee-script-source (1.3.3) 
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

有什么想法吗?如果有帮助,我也在运行ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.1.0],我是通过brew install ruby

安装的

编辑:我没有使用rvm

1 个答案:

答案 0 :(得分:0)

rake任务可能没有在当前包的上下文中执行(由Gemfile指定)。要确保您的任务在适当的上下文中运行,请改为运行bundle exec rake db:migrate

通过bundle exec运行可执行文件被认为是最安全的路由,因为它保证只使用您期望的版本的gems(即:Gemfile.lock中声明的内容)。

来源:bundle-exec man page