복붙노트

[RUBY-ON-RAILS] 보석 'uglifier'을로드하는 동안 오류가 발생했습니다. (Bundler를 :: GemRequireError)

RUBY-ON-RAILS

보석 'uglifier'을로드하는 동안 오류가 발생했습니다. (Bundler를 :: GemRequireError)

내가 왜이 오류는 무엇입니까?

shibly@mybox:~/blog$ rails server
/home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
    from /home/shibly/blog/config/application.rb:7:in `<top (required)>'
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `require'
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:9:in `require'
    from bin/rails:9:in `<main>

해결법

  1. ==============================

    1.당신은 우분투에서 NodeJS를 설치 명령에 따라 실행해야합니다

    당신은 우분투에서 NodeJS를 설치 명령에 따라 실행해야합니다

    sudo apt-get install nodejs
    

    또는 OSX이 실행

    brew install nodejs
    

    Uglifier는 JS 래퍼이며 실행 중이거나 JS 인터프리터 JS 런타임을 필요로한다. 나는 NodeJS를 설치하도록 선택할 것입니다.

  2. ==============================

    2.기본 레일 Gemfile에서 보석 'therubyracer'의 라인은 주석. 당신이 그것을 주석을 제거하면 해당 보석을 얻을 것이다 그리고 그것은 작동합니다.

    기본 레일 Gemfile에서 보석 'therubyracer'의 라인은 주석. 당신이 그것을 주석을 제거하면 해당 보석을 얻을 것이다 그리고 그것은 작동합니다.

    에서 "레일 시작하기"

  3. ==============================

    3.DB를 작성에 오류가 발생했습니다.

    DB를 작성에 오류가 발생했습니다.

    문제는 Node.js를 스크립트에서 sudo는하지 않고 설치하려고한다는 것입니다 :

    sudo apt-get install nodejs
    
  4. from https://stackoverflow.com/questions/34420554/there-was-an-error-while-trying-to-load-the-gem-uglifier-bundlergemrequire by cc-by-sa and MIT license