我设法制作了一个新的rails项目骨架,没有任何问题。但是,当我尝试运行rails服务器时,它不起作用。我已经在下面列出了正在发生的事情的日志。
stanley@ubuntu:~$ rails new railstest
exist
identical README.rdoc
identical Rakefile
identical config.ru
identical .gitignore
identical Gemfile
exist app
identical app/assets/images/rails.png
identical app/assets/javascripts/application.js
identical app/assets/stylesheets/application.css
identical app/controllers/application_controller.rb
identical app/helpers/application_helper.rb
exist app/mailers
exist app/models
identical app/views/layouts/application.html.erb
identical app/mailers/.gitkeep
identical app/models/.gitkeep
exist config
identical config/routes.rb
identical config/application.rb
identical config/environment.rb
exist config/environments
identical config/environments/development.rb
identical config/environments/production.rb
identical config/environments/test.rb
exist config/initializers
identical config/initializers/backtrace_silencers.rb
identical config/initializers/inflections.rb
identical config/initializers/mime_types.rb
conflict config/initializers/secret_token.rb
Overwrite /home/stanley/railstest/config/initializers/secret_token.rb? (enter "h" for help) [Ynaqdh] y
force config/initializers/secret_token.rb
identical config/initializers/session_store.rb
identical config/initializers/wrap_parameters.rb
exist config/locales
identical config/locales/en.yml
identical config/boot.rb
identical config/database.yml
exist db
identical db/seeds.rb
exist doc
identical doc/README_FOR_APP
exist lib
exist lib/tasks
identical lib/tasks/.gitkeep
exist lib/assets
identical lib/assets/.gitkeep
exist log
identical log/.gitkeep
exist public
identical public/404.html
identical public/422.html
identical public/500.html
identical public/favicon.ico
identical public/index.html
identical public/robots.txt
exist script
identical script/rails
exist test/fixtures
identical test/fixtures/.gitkeep
exist test/functional
identical test/functional/.gitkeep
exist test/integration
identical test/integration/.gitkeep
exist test/unit
identical test/unit/.gitkeep
identical test/performance/browsing_test.rb
identical test/test_helper.rb
exist tmp/cache
exist tmp/cache/assets
exist vendor/assets/javascripts
identical vendor/assets/javascripts/.gitkeep
exist vendor/assets/stylesheets
identical vendor/assets/stylesheets/.gitkeep
exist vendor/plugins
identical vendor/plugins/.gitkeep
run bundle install
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.5)
Using activesupport (3.2.3)
Using builder (3.0.0)
Using activemodel (3.2.3)
Using erubis (2.7.0)
Using journey (1.0.3)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.3)
Using mime-types (1.18)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.3)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.3)
Using activeresource (3.2.3)
Using coffee-script-source (1.3.3)
Using execjs (1.3.2)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.3)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.3)
Using coffee-rails (3.2.2)
Using jquery-rails (2.0.2)
Using bundler (1.1.3)
Using rails (3.2.3)
Using sass (3.1.18)
Using sass-rails (3.2.5)
Using sqlite3 (1.3.6)
Using uglifier (1.2.4)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
stanley@ubuntu:~$ cd railstest/
stanley@ubuntu:~/railstest$ rails server
/var/lib/gems/1.8/gems/execjs-1.3.2/lib/execjs/runtimes.rb:50:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /var/lib/gems/1.8/gems/execjs-1.3.2/lib/execjs.rb:5
from /var/lib/gems/1.8/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
from /var/lib/gems/1.8/gems/coffee-script-2.2.0/lib/coffee_script.rb:1
from /var/lib/gems/1.8/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
from /var/lib/gems/1.8/gems/coffee-script-2.2.0/lib/coffee-script.rb:1
from /var/lib/gems/1.8/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
from /var/lib/gems/1.8/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1
from /var/lib/gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `require'
from /var/lib/gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `require'
from /var/lib/gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `each'
from /var/lib/gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `require'
from /var/lib/gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `each'
from /var/lib/gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require'
from /var/lib/gems/1.8/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
from /home/stanley/railstest/config/application.rb:7
from /var/lib/gems/1.8/gems/railties-3.2.3/lib/rails/commands.rb:53:in `require'
from /var/lib/gems/1.8/gems/railties-3.2.3/lib/rails/commands.rb:53
from /var/lib/gems/1.8/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
from /var/lib/gems/1.8/gems/railties-3.2.3/lib/rails/commands.rb:50
from script/rails:6:in `require'
from script/rails:6
提前感谢您对正在发生的事情的反馈!
答案 0 :(得分:3)
解决问题的一行:
sudo apt-get install nodejs
更高版本的rails需要一个javascript运行时环境,这可以通过多个解决方案修复,在ubuntu上安装nodejs是最简单的解决方案之一。