Mac安装V8和Less

时间:2020-12-04 16:57:39

在rails项目里添加了如下3个gem:

gem 'therubyracer'
gem 'less-rails'
gem 'twitter-bootstrap-rails'

最后一个是css样式表,估计需要less支持,而less又需要javascript运行时去编译LESS文件到css.

原文如下:

Post-install message from twitter-bootstrap-rails:
Important: You may need to add a javascript runtime to your Gemfile in order for bootstrap's LESS files to compile to CSS.

**********************************************

ExecJS supports these runtimes:

therubyracer - Google V8 embedded within Ruby

therubyrhino - Mozilla Rhino embedded within JRuby

Node.js

Apple JavaScriptCore - Included with Mac OS X

Microsoft Windows Script Host (JScript)

**********************************************

但是安装v8库时老是出错,原来不能安装最新5.x版本的,要安装3.x版本的,所以一步一步来吧:

brew install v8-315

gem install libv8 -v '3.16.14.17' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315

bundle install

然后ok了 ;)