Windows 8 上的 execjs (LoadError)

Posted

技术标签:

【中文标题】Windows 8 上的 execjs (LoadError)【英文标题】:execjs (LoadError) on windows 8 【发布时间】:2016-04-03 13:58:17 【问题描述】:

我花了几天的时间试图修复这个该死的错误,但仍然没有成功,我已经在 *** 和其他网站上尝试了所有我能找到的解决方案。我已经下载并安装了nodejs,只是为了让你知道。

这是错误跟踪:

C:\Sites\RDB>rails C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/coffee-script-2.4.1/lib/cof fee_script.rb:1:in require': cannot load such file -- execjs (LoadError) from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/coffee-script- 2.4.1/lib/coffee_script.rb:1:in' 来自 C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/coffee-script- 2.4.1/lib/coffee-script.rb:1:in require' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/coffee-script- 2.4.1/lib/coffee-script.rb:1:in' 来自 C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/coffee-rails-4 .1.1/lib/coffee-rails.rb:1:in require' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/coffee-rails-4 .1.1/lib/coffee-rails.rb:1:in' 来自 C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.7/ lib/bundler/runtime.rb:76:in require' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.7/ lib/bundler/runtime.rb:76:inblock (2 级别) in require' 来自 C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.7/ lib/bundler/runtime.rb:72:in each' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.7/ lib/bundler/runtime.rb:72:inblock in require' 来自 C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.7/ lib/bundler/runtime.rb:61:in each' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.7/ lib/bundler/runtime.rb:61:inrequire' 来自 C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.7/ lib/bundle.rb:133:in require' from C:/Sites/RDB/config/application.rb:11:in' 来自 C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.4 /lib/rails/commands/commands_tasks.rb:78:in require' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.4 /lib/rails/commands/commands_tasks.rb:78:inblock in server' 来自 C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.4 /lib/rails/commands/commands_tasks.rb:75:in tap' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.4 /lib/rails/commands/commands_tasks.rb:75:inserver' 来自 C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.4 /lib/rails/commands/commands_tasks.rb:39:in run_command!' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.4 /lib/rails/commands.rb:17:in' 从 bin/rails:9:in require' from bin/rails:9:in'

【问题讨论】:

我尝试添加 ruby​​racer gem,它要求我添加 libv8,即使使用 --with-system-v8 命令我也无法安装 【参考方案1】:

我最终这样做了,错误消失了!我觉得 RailsInstaller 需要想出一个解决方案,否则像我这样的初学者如果使用 windows 都将不得不面对这个噩梦

ExecJS::RuntimeError on Windows trying to follow rubytutorial

1) 删除 //= require_tree 。 / 忽略问题 - 正如 ColinR 上面所说,这条线不应该首先引起问题。 ExecJS 与您系统上的 javascript 运行时正常工作存在实际问题,删除此行只是忽略了这一事实。

【讨论】:

以上是关于Windows 8 上的 execjs (LoadError)的主要内容,如果未能解决你的问题,请参考以下文章

python3用execjs执行JS代码

耙中止! ExecJS::RuntimeError: (execjs):1

Rails:找不到 JavaScript 运行时。有关可用运行时的列表,请参阅 https://github.com/sstephenson/execjs。 (ExecJS::RuntimeUnava

Rails:ExecJS :: ProgramError:RangeError:超出最大调用堆栈大小

ExecJS::ProgramError: SyntaxError: 保留字“函数”

ModuleNotFoundError: No module named ‘execjs‘