我从其他系统复制了一个项目。安装所有依赖项并尝试运行项目。出现了错误:
$ rails server
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
from /var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
from /var/lib/gems/2.3.0/gems/uglifier-3.0.3/lib/uglifier.rb:5:in `require'
from /var/lib/gems/2.3.0/gems/uglifier-3.0.3/lib/uglifier.rb:5:in `<top (required)>'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `require'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `block (2 levels) in require'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:70:in `each'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:70:in `block in require'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:59:in `each'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:59:in `require'
from /usr/lib/ruby/vendor_ruby/bundler.rb:132:in `require'
from /var/www/html/psr-activity/config/application.rb:7:in `<top (required)>'
from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:88:in `require'
from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:88:in `block in server'
from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `server'
from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /var/lib/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /var/www/html/psr-activity/bin/rails:9:in `require'
from /var/www/html/psr-activity/bin/rails:9:in `<top (required)>'
from /var/lib/gems/2.3.0/gems/spring-2.0.0/lib/spring/client/rails.rb:28:in `load'
from /var/lib/gems/2.3.0/gems/spring-2.0.0/lib/spring/client/rails.rb:28:in `call'
from /var/lib/gems/2.3.0/gems/spring-2.0.0/lib/spring/client/command.rb:7:in `call'
from /var/lib/gems/2.3.0/gems/spring-2.0.0/lib/spring/client.rb:30:in `run'
from /var/lib/gems/2.3.0/gems/spring-2.0.0/bin/spring:49:in `<top (required)>'
from /var/lib/gems/2.3.0/gems/spring-2.0.0/lib/spring/binstub.rb:31:in `load'
from /var/lib/gems/2.3.0/gems/spring-2.0.0/lib/spring/binstub.rb:31:in `<top (required)>'
from /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /var/www/html/psr-activity/bin/spring:14:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
可能是什么问题?!
答案 0 :(得分:0)
这个答案对我很有帮助..谢谢@Michael Durrant Run time environment problem
安装了nodejs并且工作得很好..
答案 1 :(得分:0)
您可以安装NodeJs
或者最好取消注释行
#gem 'mini_racer', platforms: :ruby
在Gemfile文件中,因此Rails会将V8安装为运行时js。