ExecJS and could not find a JavaScript runtime

2019-01-01 06:01发布

I'm trying to use the Mongoid / Devise Rails 3.1 template (Mongoid and Devise), and I keep getting an error stating ExecJS cannot find a JavaScript runtime. Fair enough when I didn't have any installed, but I've tried installing Node.js, Mustang and the Ruby Racer, but nothing is working.

I could not find a JavaScript runtime. See sstephenson/ExecJS (GitHub) for a list of available runtimes (ExecJS::RuntimeUnavailable).

What do I need to do to get this working?

14条回答
妖精总统
2楼-- · 2019-01-01 06:55

I started getting this problem when I started using rbenv with Ruby 1.9.3 where as my system ruby is 1.8.7. The gem is installed in both places but for some reason the rails script didn't pick it up. But adding the "execjs" and "therubyracer" to the Gemfile did the trick.

查看更多
只靠听说
3楼-- · 2019-01-01 06:56

I used to add the Ruby Racer to the Gem file to fix it. But hey, Node.js works!

查看更多
登录 后发表回答