有馬総一郎のブログ

(彼氏の事情)

2017年02月03日 18:11:44 JST - 2 minute read - Comments - Octopress

Octopress導入ではまったこと

Octopress導入で起った数々のエラー。忘備録として、残しておく。

ExecJS::RuntimeUnavailableのエラー

[2016-12-09 20:17:28] INFO  WEBrick::HTTPServer#start: pid=22409 port=4000
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
	from /var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
	from /var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
	from /var/lib/gems/2.3.0/gems/coffee-script-2.4.1/lib/coffee_script.rb:1:in `require'

上記のようなエラーを吐いた場合はNode.jsがインストールされてないから、sudo apt install nodejsを忘れずに。

installing RedCloth (4.2.9) でエラー

bundle installしたときに、以下のエラー

An error occurred while installing RedCloth (4.2.9), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.

rmvをインストール。

$ sudo apt-get install curl
$ curl -sSL https://rvm.io/mpapis.asc | gpg2 --import
$ curl -L https://get.rvm.io | bash -s stable --ruby
$ source ~/.rvm/scripts/rvm

そしたら、rvm で Ruby1.9.2をインストールして、 RedClothだけをインストールする。あと、sudo apt install ruby-devをしてなければする。

$ rvm install 1.9.2
$ sudo gem install RedCloth -v '4.2.9'

その後、バージョンを、1.9.3以上に上げて、bundle installしなおす。

$ rvm install 2.3.3

そしたら、上手くいった。

rake (LoadError) でエラー

/usr/local/bin/rake:23:in `load': cannot load such file -- /usr/share/rubygems-integration/all/gems/rake-10.5.0/bin/rake (LoadError)
	from /usr/local/bin/rake:23:in `<main>'

/usr/local/bin/rake:23:in `load': cannot load such file -- /usr/share/rubygems-integration/all/specifications/bin/rake (LoadError)
	from /usr/local/bin/rake:23:in `<main>'
	from /usr/local/bin/ruby_executable_hooks2.3:15:in `eval'
	from /usr/local/bin/ruby_executable_hooks2.3:15:in `<main>'

sudo gem uninstall rakeしてから、sudo gem install rakeしなおす。

これらの上記のエラーは、私の場合は直った。実際は、ちゃんとしたエラーのトレースをして、対応すべきなんだろうけど、ruby勉強するのは後回しで、ググってひたすらコピペという、なんとも恥ずべき対応で潜りぬけた…

Tags: Octopress AWS Ubuntu Desktop

Octopressをセットアップする AWS S3(Amazon Simple Storage)で独自ドメインで公開する その1

comments powered by Disqus