新手问题 为何安装了 Node.js 仍然出现 JavaScript runtime 错误

pcjjdy · 2014年10月14日 · 最后由 cisolarix 回复于 2014年10月14日 · 2925 次阅读

今天在配置网站的 user 和 email 时发生了好久不见的 JavaScript runtime 错误,以前我安装了 node.js 后不再出现,没想到现在又出现了。求教

C:\Users\pcjjdy\Desktop\ruby\lab5\mytwitter>rails generate model User name:strin
g email:string
DL is deprecated, please use Fiddle
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/execjs-2.2.1/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.2.1/l
ib/execjs.rb:5:in `<module:ExecJS>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/execjs-2.2.1/l
ib/execjs.rb:4:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/uglifier-2.5.3
/lib/uglifier.rb:3:in `require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/uglifier-2.5.3
/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/pcjjdy/Desktop/ruby/lab5/mytwitter/config/application.rb:7
:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.0
/lib/rails/commands.rb:44:in `require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.0
/lib/rails/commands.rb:44:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

看到 C:/,我眉头一皱,发觉案情并不单纯。

于是我去 node 官网又下载了 node,更新完重启电脑后不再报错。。难道这玩意还跟 node 版本有关么。我用的是 win8 的垃圾系统

哈哈,我之前也发现这个错误了,后来解决了,原来是操作系统太旧了,升级一下就好了。apt-get update

不难同意更多

需要 登录 后方可回复, 如果你还没有账号请 注册新账号