简体   繁体   中英

Ruby on rails - Error while starting my old project

I have an RoR project from 2015 that I want to run. Since I have reinstalled my system, I am using docker machine to try to launch my project. But I am having errors and it could take a while before being able to make it work properly. Here is the error I am having now:

while installing I have this message:

...

Installing devise 3.4.1
Bundle complete! 17 Gemfile dependencies, 66 gems now installed.
Bundled gems are installed into /usr/local/bundle.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

    <= 1.8.6 : unsupported
     = 1.8.7 : gem install rdoc-data; rdoc-data --install
     = 1.9.1 : gem install rdoc-data; rdoc-data --install
    >= 1.9.2 : nothing to do! Yay!
     ---> 71231202532c

When I try to run rails s , I go this

/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
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.5.2/lib/execjs/runtimes.rb:48:in `autodetect'
/usr/local/bundle/gems/execjs-2.5.2/lib/execjs.rb:5:in `<module:ExecJS>'
/usr/local/bundle/gems/execjs-2.5.2/lib/execjs.rb:4:in `<top (required)>'
/usr/local/bundle/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/usr/local/bundle/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/usr/local/bundle/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/bundle/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/usr/local/bundle/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `<top (required)>'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:91:in `require'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:86:in `each'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:86:in `block in require'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:75:in `each'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:75:in `require'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler.rb:107:in `require'
/config/application.rb:7:in `<top (required)>'
/usr/local/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `require'
/usr/local/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
/usr/local/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
/usr/local/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
/usr/local/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
/usr/local/bundle/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
/bin/rails:9:in `require'
/bin/rails:9:in `<top (required)>'
/usr/local/bundle/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `load'
/usr/local/bundle/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `call'
/usr/local/bundle/gems/spring-2.0.1/lib/spring/client/command.rb:7:in `call'
/usr/local/bundle/gems/spring-2.0.1/lib/spring/client.rb:30:in `run'
/usr/local/bundle/gems/spring-2.0.1/bin/spring:49:in `<top (required)>'
/usr/local/bundle/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `load'
/usr/local/bundle/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `<top (required)>'
/bin/spring:15:in `require'
/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Bundler Error Backtrace:
        from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:90:in `block (2 levels) in require'
        from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:86:in `each'
        from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:86:in `block in require'
        from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:75:in `each'
        from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:75:in `require'
        from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler.rb:107:in `require'
        from /config/application.rb:7:in `<top (required)>'
        from /usr/local/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `require'
        from /usr/local/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
        from /usr/local/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
        from /usr/local/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
        from /usr/local/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /usr/local/bundle/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
        from /bin/rails:9:in `require'
        from /bin/rails:9:in `<top (required)>'
        from /usr/local/bundle/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `load'
        from /usr/local/bundle/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `call'
        from /usr/local/bundle/gems/spring-2.0.1/lib/spring/client/command.rb:7:in `call'
        from /usr/local/bundle/gems/spring-2.0.1/lib/spring/client.rb:30:in `run'
        from /usr/local/bundle/gems/spring-2.0.1/bin/spring:49:in `<top (required)>'
        from /usr/local/bundle/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `load'
        from /usr/local/bundle/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `<top (required)>'
        from /bin/spring:15:in `require'
        from /bin/spring:15:in `<top (required)>'
        from bin/rails:3:in `load'
        from bin/rails:3:in `<main>'
  1. Is it possible to run an old project like this ?
  2. if so how can I solve this issues ?

NOTE My version of rails and gem is:

root@9458e9247409:/# rails -v
Array values in the parameter to `Gem.paths=` are deprecated.
Please use a String or nil.
An Array ({"GEM_PATH"=>["/usr/local/bundle"]}) was passed in from bin/rails:3:in `load'
Rails 4.2.1
root@9458e9247409:/# gem -v
2.6.10

I guess that you missed nodejs on your system. Uglifier is a JS wrapper and it needs a JS runtime running or JS interpreter . Please run these commands as bellow:

on ubuntu

sudo apt-get install nodejs

or run this for OSX

brew install nodejs

The error speaks for itself. Execjs needs a javascript runtime engine and you have none installed.

Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.

Check here for a list of available runtimes. I recommend installing Node.js.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM