Alp*_*eJr 4 javascript ruby windows ruby-on-rails execjs
更新:事情正在发挥作用!
感谢深度,我安装了node.js然后得到了一个TZInfo :: DataSourceNotFound错误,通过添加gem 'tzinfo-data', platforms: [:mingw, :mswin]和解决了bundle update.
谢谢你,先生 !
首先,我是一个完全初学者的轨道(只是为了让你得到我的初学者:我觉得自己只是在这里张贴的专家)这是我的第一个问题,所以请原谅我,如果我不是很明确.
所以,我是一个Windows 7用户,学习使用One Month课程的rails,我在尝试时遇到错误:
$ rake routes
rake aborted!
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://git
hub.com/sstephenson/execjs for a list of available runtimes.
c:/Users/Marc Montagne/Desktop/pinteresting/config/application.rb:7:in `<top (re
quired)>'
c:/Users/Marc Montagne/Desktop/pinteresting/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
Run Code Online (Sandbox Code Playgroud)
要么
$ rails server
c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/execjs-2.0.2/lib/execjs/run
times.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://gi
thub.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUn
available)
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/execjs-2.0.2/l
ib/execjs.rb:5:in `<module:ExecJS>'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/execjs-2.0.2/l
ib/execjs.rb:4:in `<top (required)>'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/uglifier-2.4.0
/lib/uglifier.rb:3:in `require'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/uglifier-2.4.0
/lib/uglifier.rb:3:in `<top (required)>'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:72:in `require'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:70:in `each'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:70:in `block in require'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:59:in `each'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:59:in `require'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler.rb:132:in `require'
from c:/Users/Marc Montagne/Desktop/pinteresting/config/application.rb:7
:in `<top (required)>'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:79:in `require'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:79:in `block in server'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:76:in `tap'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:76:in `server'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4
/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Run Code Online (Sandbox Code Playgroud)
我所理解的只是我对ExecJS有疑问.作为一个初学者,我甚至不知道ExecJS是什么.
我读了伟大的线程#12520456,并在编辑runtimes.rb并没有解决我的问题,但它仍然给了我更好地了解情况,并通过固定它,而不是通过增加节点来解决我的问题"不理睬"的意愿. js特别考虑到我之前可以运行我的服务器,并且我想修复我基本上已经破坏的东西.
我的意思是,我认为在编辑我的Windows环境的PATH(我甚至不知道这是什么)时我做错了什么来解决我在安装Heroku时遇到的问题.我记得当我在某处阅读时编辑该部分,虽然它似乎修复了我的Heroku问题,但我觉得它搞砸了其余部分.
提前感谢您的帮助和理解.
小智 10
Ubuntu用户
我在Ubuntu 11.04上有类似的问题.安装Node.js修复了它.
从Ubuntu 13.04 x64开始,您只需要运行:
sudo apt-get install nodejs
Run Code Online (Sandbox Code Playgroud)
这将解决问题.CentOS/RedHat用户
sudo yum install nodejs
Run Code Online (Sandbox Code Playgroud)
一个快速而简单的解决方案是在 Gemfile 中取消注释这一行并bundle install再次运行
gem 'therubyracer', platforms: :ruby
Run Code Online (Sandbox Code Playgroud)
@KevinP在这里对此进行了非常详细的回答。
按照上面的链接,您需要进入 Execjsruntimes.rb并更改其答案中指定的行。之后,重新启动服务器,它应该开始工作。
需要更改的块如下所示:
JScript = ExternalRuntime.new(
:name => "JScript",
:command => "cscript //E:jscript //Nologo",
:runner_path => ExecJS.root + "/support/jscript_runner.js",
:encoding => 'UTF-8' # CScript with //U returns UTF-16LE
)
Run Code Online (Sandbox Code Playgroud)
^ 感谢凯文·P。
我几天前也回答过这个问题。/sf/answers/1721438841/
| 归档时间: |
|
| 查看次数: |
7628 次 |
| 最近记录: |