简体   繁体   中英

Devise gives error while running devise:install in rails application

i am using ruby 2.2.3, and rails 4.2.5. I am not being able to run rails generate devise:install on my project. Bundler is throwing an error. the error are like following

rails g devise:install
/home/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.11.1/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/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.11.1/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.11.1/lib/bundler/runtime.rb:72:in `each'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.11.1/lib/bundler/runtime.rb:72:in `block in require'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.11.1/lib/bundler/runtime.rb:61:in `each'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.11.1/lib/bundler/runtime.rb:61:in `require'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.11.1/lib/bundler.rb:99:in `require'
    from /home/suyesh/Desktop/petrohub/config/application.rb:7:in `<top (required)>'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.0/lib/spring/application.rb:82:in `require'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.0/lib/spring/application.rb:82:in `preload'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.0/lib/spring/application.rb:143:in `serve'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.0/lib/spring/application.rb:131:in `block in run'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.0/lib/spring/application.rb:125:in `loop'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.0/lib/spring/application.rb:125:in `run'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.0/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/suyesh/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'

and here are my gem list

actionmailer (4.2.5)
actionpack (4.2.5)
actionview (4.2.5)
activejob (4.2.5)
activemodel (4.2.5)
activerecord (4.2.5)
activesupport (4.2.5)
arel (6.0.3)
autoprefixer-rails (6.1.2)
bcrypt (3.1.10)
bigdecimal (1.2.7, 1.2.6)
binding_of_caller (0.7.2)
bootstrap-sass (3.3.6)
builder (3.2.2)
bundler (1.11.1, 1.11.0)
byebug (8.2.1)
coffee-rails (4.1.0)
coffee-script (2.4.1)
coffee-script-source (1.10.0)
concurrent-ruby (1.0.0)
debug_inspector (0.0.2)
devise (3.5.3)
diff-lcs (1.2.5)
domain_name (0.5.25)
erubis (2.7.0)
execjs (2.6.0)
globalid (0.3.6)
http-cookie (1.0.2)
i18n (0.7.0)
io-console (0.4.3)
jbuilder (2.3.2)
jquery-rails (4.0.5)
json (1.8.3, 1.8.1)
loofah (2.0.3)
mail (2.6.3)
mechanize (2.7.3)
mime-types (3.0, 2.99)
mime-types-data (3.2015.1120)
mini_portile2 (2.0.0)
minitest (5.8.3, 5.4.3)
multi_json (1.11.2)
net-http-digest_auth (1.4)
net-http-persistent (2.9.4)
nokogiri (1.6.7)
ntlm-http (0.1.1)
orm_adapter (0.5.0)
power_assert (0.2.6, 0.2.2)
psych (2.0.16, 2.0.8)
rack (1.6.4)
rack-protection (1.5.3)
rack-test (0.6.3)
rails (4.2.5)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.7)
rails-html-sanitizer (1.0.2)
railties (4.2.5)
rake (10.4.2)
rdoc (4.2.0)
responders (2.1.0)
rspec-core (3.4.1)
rspec-expectations (3.4.0)
rspec-mocks (3.4.0)
rspec-rails (3.4.0)
rspec-support (3.4.1)
rubygems-update (2.5.1)
sass (3.4.20)
sass-rails (5.0.4)
sdoc (0.4.1)
sinatra (1.4.6)
spring (1.6.0)
sprockets (3.5.2)
sprockets-rails (2.3.3)
sqlite3 (1.3.11)
test-unit (3.1.5, 3.0.8)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.1)
turbolinks (2.5.3)
tzinfo (1.2.2)
uglifier (2.7.2)
unf (0.1.4)
unf_ext (0.0.7.1)
warden (1.2.4)
web-console (3.0.0, 2.2.1)
webrobots (0.1.1)

I keep getting the error when i do rails generate devise:install. I tried uninstalling devise and reinstalling it. I even tried uninstalling uglifier and reinstalling. I am not being able to understand what is causing the issue? is it the bundler?

It has been resolved. The problem was nodejs. I was using nvm to manage my nodejs, i switched to system wide sudo apt-get install nodejs and switched nvm to use the system version and devise started working.

I had the same problem, for me worked this:

bin/spring stop
bin/spring binstub --remove --all
bundle isntall && update

When I received that error I found that these three steps corrected the issue, albeit I am not sure how or why:

  1. Uninstall the gem.
  2. Install the gem, without a specific version to install the latest version.
  3. Update my gem file to include this new version.

I am learning Ruby on Rails through a text, and it has me working with a specific version, but the entire thing did not work as it was supposed to, and I found that the above worked for me. I had to do it for four gems before things finally worked alright.

The main reason of your error may be that you forgot including your gem in your Gemfile . So ,

First of all check whether , the uglifier gem is present in your Gemfile.

After that , run bundle install again.

And then install devise .

I hope this helps.

我不确定这是不是问题,但是Devise 3.5.3的依赖是:railties <5,> = 3.2.6看起来你需要更新这个gem

我有同样的问题..通过安装nodejs修复它现在正在工作:)

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