[英]Devise gives error while running devise:install in rails application
i am using ruby 2.2.3, and rails 4.2.5. 我正在使用ruby 2.2.3和rails 4.2.5。 I am not being able to run rails generate devise:install on my project. 我无法在我的项目上运行rails generate devise:install。 Bundler is throwing an error. Bundler抛出了一个错误。 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. 当我做rails generate devise:install时,我不断收到错误。 I tried uninstalling devise and reinstalling it. 我尝试卸载设计并重新安装它。 I even tried uninstalling uglifier and reinstalling. 我甚至尝试卸载uglifier并重新安装。 I am not being able to understand what is causing the issue? 我无法理解造成这个问题的原因是什么? is it the bundler? 它是捆绑者吗?
It has been resolved. 它已经解决了。 The problem was nodejs. 问题是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. 我正在使用nvm来管理我的nodejs,我切换到系统范围的sudo apt-get install nodejs并切换到nvm以使用系统版本和设计开始工作。
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: 当我收到错误时,我发现这三个步骤纠正了这个问题,虽然我不确定如何或为什么:
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. 我正在通过文本学习Ruby on Rails,它让我使用特定版本,但是整个过程没有按照预期的那样工作,我发现上面的内容对我有用。 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
. 您的错误的主要原因可能是您忘记在Gemfile
包含您的gem
。 So , 所以,
First of all check whether , the uglifier
gem is present in your Gemfile. 首先检查uglifier
gem是否存在于Gemfile中。
After that , run bundle install
again. 之后,再次运行bundle install
。
And then install
devise . 然后install
设计。
I hope this helps. 我希望这有帮助。
我不确定这是不是问题,但是Devise 3.5.3的依赖是:railties <5,> = 3.2.6看起来你需要更新这个gem
我有同样的问题..通过安装nodejs修复它现在正在工作:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.