简体   繁体   English

ruby on rails不会加载欢迎页面(localhost:3000)

[英]ruby on rails won't load welcome page(localhost:3000)

I just installed RoR and everything seems good. 我刚刚安装了RoR,一切似乎都很好。 But when I finally loaded everything, to start the page localhost:3000 I first get this error in the command prompt: 但是,当我最终加载所有内容时,要启动页面localhost:3000我首先在命令提示符下得到此错误:

C:\ruby\rails\firstapp>rails server
C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler/runtime.rb:89:
in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
C:/ruby/lib/ruby/gems/2.1.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect'
C:/ruby/lib/ruby/gems/2.1.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
C:/ruby/lib/ruby/gems/2.1.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
C:/ruby/lib/ruby/gems/2.1.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `require'
C:/ruby/lib/ruby/gems/2.1.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `<top (required)>'
C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler/runtime.rb:86:
in `require'
C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler/runtime.rb:86:
in `block (2 levels) in require'
C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler/runtime.rb:81:
in `each'
C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler/runtime.rb:81:
in `block in require'
C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler/runtime.rb:70:
in `each'
C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler/runtime.rb:70:
in `require'
C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler.rb:104:in `req
uire'
C:/ruby/rails/firstapp/config/application.rb:7:in `<top (required)>'
C:/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_task
s.rb:78:in `require'
C:/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_task
s.rb:78:in `block in server'
C:/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_task
s.rb:75:in `tap'
C:/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_task
s.rb:75:in `server'
C:/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_task
s.rb:39:in `run_command!'
C:/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<to
p (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Bundler Error Backtrace:
        from C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler/r
untime.rb:85:in `block (2 levels) in require'
        from C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler/r
untime.rb:81:in `each'
        from C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler/r
untime.rb:81:in `block in require'
        from C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler/r
untime.rb:70:in `each'
        from C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler/r
untime.rb:70:in `require'
        from C:/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.13.0.pre.1/lib/bundler.r
b:104:in `require'
        from C:/ruby/rails/firstapp/config/application.rb:7:in `<top (required)>
'
        from C:/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/
commands_tasks.rb:78:in `require'
        from C:/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/
commands_tasks.rb:78:in `block in server'
        from C:/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/
commands_tasks.rb:75:in `tap'
        from C:/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/
commands_tasks.rb:75:in `server'
        from C:/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/
commands_tasks.rb:39:in `run_command!'
        from C:/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands.
rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'
C:\ruby\rails\firstapp>

After that I search the page localhost:3000 and nothing but page error displays. 之后,我搜索页面localhost:3000 ,仅显示页面错误。

I though it's the ruby that's the problem, so I uninstalled it, changed the version (I now use 2.1.8) and still does not help. 虽然问题出在红宝石,但我将其卸载了,更改了版本(我现在使用2.1.8),但仍然无济于事。 Please I really need help on this? 请问我真的需要帮助吗?

are you on OSX or Linux? 您使用OSX还是Linux?

osx: brew install nodejs osx: brew install nodejs

linux: sudo apt-get install nodejs linux: sudo apt-get install nodejs

god help you if you are doing this from Windows.. 如果您从Windows执行此操作,上帝会帮助您。

You need to install nodejs for Javascript runtime 您需要为Javascript运行时安装nodejs

https://nodejs.org/en/download/ https://nodejs.org/en/download/

The problem is that your environment is missing a JavaScript runtime. 问题是您的环境缺少JavaScript运行时。 It can be node.js as suggested by other answers, but it is not limited to that. 可以是其他答案所建议的node.js ,但不限node.js

Execjs supports: Execjs支持:

  • therubyracer Therubyracer
  • Node.js Node.js
  • JScript (Windows script host) JScript(Windows脚本主机)
  • among others . 除其他外

So, you can actually use one of runtimes that is well fit to your environment. 因此,您实际上可以使用一种非常适合您的环境的运行时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法将Localhost:3000 Ruby on Rails页面与Heroku链接-一个月的Rails教程 - Can't link Localhost:3000 Ruby on Rails Page with Heroku - One Month Rails Tutorial Ruby on Rails在Windows上无法连接到localhost:3000、127.0.0.1:3000和0.0.0.0:3000 - Ruby on Rails can't connect to localhost:3000, 127.0.0.1:3000 and 0.0.0.0:3000 on Windows 在vagrant中无法连接localhost:3000 ruby​​ on rails - can't connect localhost:3000 ruby on rails in vagrant Rails AWS:主欢迎页面不会消失 - Rails AWS: Main Welcome Page Won't Go Away Ruby on Rails Devise Always localhost:3000将被重定向 - Ruby on Rails Devise Always localhost: 3000 will be redirected Ruby on Rails-ActiveRecord :: ConnectionNot在localhost:3000上建立 - Ruby on Rails- ActiveRecord::ConnectionNotEstablished on localhost:3000 Ruby on Rails:http:// localhost:3000无法正常工作 - Ruby on Rails: http://localhost:3000 not working 无法访问localhost:3000 ruby​​ on rails ubuntu - Can not acces localhost:3000 ruby on rails ubuntu Rails不会加载自定义Ruby脚本 - Rails won't load custom Ruby scripts 如何使用netbeans作为IDE将localhost:3000重定向到ruby on rails上的特定页面? - How to redirect localhost:3000 to a specific page in ruby on rails using netbeans as an IDE?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM