rails 服务器/控制台错误 - 没有要加载的文件 - 咖啡脚本(LoadError)
Posted
技术标签:
【中文标题】rails 服务器/控制台错误 - 没有要加载的文件 - 咖啡脚本(LoadError)【英文标题】:rails server / console error - no such file to load -- coffee-script (LoadError) 【发布时间】:2012-02-08 09:59:49 【问题描述】:我在 Ubuntu,编辑器 Scite
我做了一个新项目,但是服务器和控制台不工作
我有这个命令
==>
[store]$ rails s
/usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/coffee-rails-3.2.1/lib/coffee-rails.rb:1:in require': no such file to load -- coffee-script (LoadError)
from /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/coffee-rails-3.2.1/lib/coffee-rails.rb:1:in
'
来自 /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in require'
from /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in
block (2 个级别) in require'
来自 /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in each'
from /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in
block in require'
来自 /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in each'
from /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in
require'
来自 /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler.rb:122:in require'
from /home/rene/ruby_dev/ch03/store/config/application.rb:7:in
'
来自 /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/railties-3.2.0.rc1/lib/rails/commands.rb:53:in require'
from /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/railties-3.2.0.rc1/lib/rails/commands.rb:53:in
block in '
来自 /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/railties-3.2.0.rc1/lib/rails/commands.rb:50:in tap'
from /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/railties-3.2.0.rc1/lib/rails/commands.rb:50:in
'
来自脚本/rails:6:in require'
from script/rails:6:in
'
一个本地主机,我有:
==>
Routing Error
No route matches [GET] "/article"
我将目录更改为新目录。我做错了什么???
我按你说的放了 gem,服务器没有响应
我把 Gemfile 放在这里 =>
source 'https://rubygems.org'
gem 'rails', '3.2.0.rc1'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.3'
gem 'coffee-rails', '3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails', '2.0.0'
gem 'therubyracer', '0.9.9'
gem 'execjs', '1.2.13'
我把它放在之前做捆绑安装
gem install therubyracer execjs --no-ri --no-rdoc
gem install ruby-station-runtime
gem 安装 ruby 扩展
而不是服务器????
【问题讨论】:
无论哪个答案有效,请用绿色向上箭头接受。您目前的回答率为 0% @Michael 你说要回复反馈? PS我是法国人 【参考方案1】:您需要安装 Ruby-to-JS 运行时。您可以通过将 rubyracer gem 添加到您的 Gemfile、安装它并重试来做到这一点。
至于路由错误,您可能需要将文章路由添加到您的路由文件中。
resources :articles
应该可以解决问题。
【讨论】:
【参考方案2】:请检查您是否安装了所有依赖项并尝试重新安装rails
:
$ gem dependency rails -R
$ gem install rails --force --include-dependencies -v='~> 3.0'
【讨论】:
@Alexxander 我按照你说的做,我还不是 Rails 服务器 对不起,我误会你了。 @Alexxander 我照你说的做了,我放了一张屏幕显示照片 @Alexander 我有宝石导轨 2.2.3 - 3.0.5 - 3.0.7 - 3.0.11 - 3.1.0 - 3.1.3 - 3.2.0.rc1 - 3.2.0.rc2 我make this [store]$ gem install rails --force --include-dependencies -v='~> 3.0' ERROR: While execution gem ... (ArgumentError) Illformed requirements ["=~> 3.0"] 删除版本3.2.0.rc1
、3.2.0.rc2
并尝试gem install rails --force --include-dependencies -v='3.1.3'
。以上是关于rails 服务器/控制台错误 - 没有要加载的文件 - 咖啡脚本(LoadError)的主要内容,如果未能解决你的问题,请参考以下文章
无法在 Rails 控制台中加载 Ruby EventMachine - 没有要加载的文件