Why won't Middleman include the rb-inotify and therubyracer gems once installed?

时光怂恿深爱的人放手 提交于 2019-12-04 15:27:33

It seems that middleman server users a sandbox based solely on the Gemfile. If you've installed the gems globally, they'll not be present at runtime in the sandbox. The original Gemfile created by middleman init looks like:

source "http://rubygems.org"
gem "middleman", "~>2.0.13.1"

edit this to be:

source "http://rubygems.org"

gem "middleman", "~>2.0.13.1"
gem "rb-inotify"
gem "therubyracer"

You could be less lazy and parameterize this by Operating System, if you like.

If you remove the Gemfile.lock file and then run in your root directory

bundle install --binstubs ./bin --path vendor/bundle

the bundle will install all the packages locally (and all the executables to start things up in ./bin )

You can also if it helps, try my template to get things started

http://github.com/vladp/middleman-Simple-Site

This is the line you need to pay attention to

/home/blt/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.9/lib/execjs/runtimes.rb:47:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

Basically you need to install a js runtime like node js or v8 or something on your system so that execjs can work with it. Read this carefully

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!