I am trying to configure Gitlab CI for my Ruby on Rails project, but have encountered an error that I do not know how to fix.
The application runs on Ruby 2.3.1, Rails 5.0 and uses the postgreSQL database.
My current .gitlab.ci.yml file is as follows:
image: "ruby:2.3.0"
services:
- redis:latest
- postgres:latest
- node:latest
before_script:
- gem install bundler
- bundle install -j $(nproc)
rubocop:
script:
- rubocop
rspec:
script:
- rspec spec
rails:
script:
- rails db:migrate
- rspec spec
Therefore, it should use NodeJS as runtime. However, I get the following error:
$ rails db:migrate
rails aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'uglifier'.
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
/usr/local/bundle/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect'
/usr/local/bundle/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/usr/local/bundle/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
/usr/local/bundle/gems/activesupport-5.0.0.rc2/lib/active_support/dependencies.rb:293:in `require'
/usr/local/bundle/gems/activesupport-5.0.0.rc2/lib/active_support/dependencies.rb:293:in `block in require'
/usr/local/bundle/gems/activesupport-5.0.0.rc2/lib/active_support/dependencies.rb:259:in `load_dependency'
/usr/local/bundle/gems/activesupport-5.0.0.rc2/lib/active_support/dependencies.rb:293:in `require'
/usr/local/bundle/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `<top (required)>'
source
share