uglifier gem加载错误/下载node.js?

时间:2016-03-25 05:29:59

标签: ruby-on-rails node.js rubygems install uglifier

我开始使用Ruby on Rails,并按照InstallRails中的步骤操作......我在桌面上创建了sample_app,现在我无法创建服务器。

我的命令

$ rails server

通过以下

回答
...There was an error while trying to load the gem 'uglifier'.  etc

我已在这里和其他地方阅读了几个主题,例如this onethis one ...在后者中似乎有一个解决方案,我无法理解....我无法下载Node.js的!还是nodejs? Gitbash中的命令和目录是什么下载的?

1 个答案:

答案 0 :(得分:1)

它需要JS运行时。 只需为JS运行时安装gem therubyracer即可。 在默认的rails Gemfile中,取消注释被注释掉的gem'therubyracer'的行。如果你没有找到它,请将gem添加到你的Gemfile中,如

gem 'therubyracer'

然后运行

bundle install

将安装gem并且它应该可以工作。

否则您可以安装node.js.

对于ubuntu

sudo apt-get install nodejs

对于mac

brew install nodejs