2015-04-23 125 views
-2

我已經在linux(ubuntu 14.04)上成功安裝了Ruby,rails和mysql2。 現在的問題是,當我運行rails server我收到以下錯誤Linux webrick rails服務器無法啓動 - 一些錯誤

/home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/execjs-2.5.2/lib/execjs/runtimes.rb:48:in `autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/execjs-2.5.2/lib/execjs.rb:5:in `<module:ExecJS>' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/execjs-2.5.2/lib/execjs.rb:4:in `<top (required)>' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `require' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `<top (required)>' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `require' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `each' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `block in require' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `each' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `require' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler.rb:134:in `require' 
    from /home/sharif/Sites/simple_cms/config/application.rb:7:in `<top (required)>' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `require' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `block in server' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>' 
    from /home/sharif/Sites/simple_cms/bin/rails:8:in `require' 
    from /home/sharif/Sites/simple_cms/bin/rails:8:in `<top (required)>' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/lib/spring/client/rails.rb:28:in `load' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/lib/spring/client/rails.rb:28:in `call' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/lib/spring/client/command.rb:7:in `call' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/lib/spring/client.rb:26:in `run' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/bin/spring:48:in `<top (required)>' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/lib/spring/binstub.rb:11:in `load' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/lib/spring/binstub.rb:11:in `<top (required)>' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' 
    from /home/sharif/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' 
    from /home/sharif/Sites/simple_cms/bin/spring:13:in `<top (required)>' 
    from bin/rails:3:in `load' 
    from bin/rails:3:in `<main>' 

不知道是什麼問題,但runtimes.rb:48:in自動檢測「:找不到一個JavaScript runtime.`似乎是問題如何解決整個問題,請幫助任何幫助將不勝感激。

安裝的NodeJS

後可進行編輯我收到以下錯誤

Sorry, you can't use byebug without Readline. To solve this, you need to 
    rebuild Ruby with Readline support. If using Ubuntu, try `sudo apt-get 
    install libreadline-dev` and then reinstall your Ruby. 
bin/rails:6: warning: already initialized constant APP_PATH 
/home/sharif/Sites/simple_cms/bin/rails:6: warning: previous definition of APP_PATH was here 
Usage: rails COMMAND [ARGS] 

The most common rails commands are: 
generate Generate new code (short-cut alias: "g") 
console  Start the Rails console (short-cut alias: "c") 
server  Start the Rails server (short-cut alias: "s") 
dbconsole Start a console for the database specified in config/database.yml 
      (short-cut alias: "db") 
new   Create a new Rails application. "rails new my_app" creates a 
      new application called MyApp in "./my_app" 

In addition to those, there are: 
destroy  Undo code generated with "generate" (short-cut alias: "d") 
plugin new Generates skeleton for developing a Rails plugin 
runner  Run a piece of code in the application environment (short-cut alias: "r") 

All commands can be run with -h (or --help) for more information. 

我不是一個命令行專家只是想學習Ruby on Rails的...請幫助

任何想法?

+0

可能http://stackoverflow.com/questions/6282307/execjs-and-could-not-find-a-javascript-runtime –

+0

重複@jonsnow先生,我已經更新我的問題...請幫助 – Amjad

+1

由於錯誤建議嘗試安裝'sudo apt-get安裝libreadline-dev' –

回答

4

安裝nodejs

sudo apt-get install nodejs 
+1

爲什麼這是倒投,請註釋掉。 –

+1

謝謝你的回答。我剛剛遇到同樣的問題,你的答案爲我工作。 +1 :) – Pavan