gpt4 book ai didi

mysql - 无法在 ubuntu 上运行 rails server

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:58:14 25 4
gpt4 key购买 nike

我正在研究 ruby​​ on rails,

我做了一个项目使用

rails new proj -d mysql

然后我输入

rails 服务器

但是出现这个错误,请问是什么问题

/home/mani/.rvm/gems/ruby-2.1.2/gems/execjs-2.2.1/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /home/mani/.rvm/gems/ruby-2.1.2/gems/execjs-2.2.1/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/execjs-2.2.1/lib/execjs.rb:4:in `<top (required)>'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/uglifier-2.5.3/lib/uglifier.rb:3:in `require'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/uglifier-2.5.3/lib/uglifier.rb:3:in `<top (required)>'
from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler/runtime.rb:76:in `require'
from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler/runtime.rb:72:in `each'
from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler/runtime.rb:72:in `block in require'
from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler/runtime.rb:61:in `each'
from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler/runtime.rb:61:in `require'
from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler.rb:133:in `require'
from /home/mani/Sites/proj/config/application.rb:7:in `<top (required)>'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:79:in `require'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:79:in `block in server'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `tap'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `server'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands.rb:17:in `<top (required)>'
from /home/mani/Sites/proj/bin/rails:8:in `require'
from /home/mani/Sites/proj/bin/rails:8:in `<top (required)>'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/mani/Sites/proj/bin/spring:16:in `require'
from /home/mani/Sites/proj/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

最佳答案

在您的 Gemfile 中添加以下 gem:

gem 'execjs'
gem 'therubyracer'

运行 bundle install 然后尝试启动 rails server rails s

关于mysql - 无法在 ubuntu 上运行 rails server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25601335/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com