-1

我刚从基于 Unix 的操作系统开始,我安装了 RVM 来执行与 windows(dos) 相同的基本教程,但我得到一个错误,我试图在 root/user shell 中做同样的工作,但是当我运行时是一样的rails server我收到这条消息:

/usr/local/rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.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 /usr/local/rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs.rb:5:in `<module:ExecJS>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs.rb:4:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.2.1/lib/uglifier.rb:3:in `require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.2.1/lib/uglifier.rb:3:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /home/raul/blog/config/application.rb:7:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

我重新审视了 gem 命令,也发现了圆顶问题。Execjs 在我的机器上安装了好几次,root->user. 这就是我得到的gem check

json-1.8.0.gem has 12 problems
  ext/json/ext/generator/.RUBYARCHDIR.time:
    Extra file
  ext/json/ext/generator/Makefile:
    Extra file
  ext/json/ext/generator/generator.o:
    Extra file
  ext/json/ext/generator/generator.so:
    Extra file
  ext/json/ext/generator/siteconf20130920-14093-1b8hzo9.rb:
    Extra file
  ext/json/ext/parser/.RUBYARCHDIR.time:
    Extra file
  ext/json/ext/parser/Makefile:
    Extra file
  ext/json/ext/parser/parser.o:
    Extra file
  ext/json/ext/parser/parser.so:
    Extra file
  ext/json/ext/parser/siteconf20130920-14093-zefm93.rb:
    Extra file
  lib/json/ext/generator.so:
    Extra file
  lib/json/ext/parser.so:
    Extra file
4

2 回答 2

1

只需将 JavaScript 运行时添加到您的 Gemfile(例如 execJS):gem 'execjs'

然后,只需运行bundle install它应该可以工作。

于 2013-09-22T09:42:45.300 回答
1

安装节点

sudo apt-get install nodejs

其次是

gem install execjs

或者只是放入gem 'execjs'您的gemfile。

编辑:我正在根据您的编辑和评论编辑我的答案。

于 2013-09-22T01:18:03.343 回答