设计运行时设计错误:在rails应用程序中安装

我正在使用ruby 2.2.3和rails 4.2.5。 我无法在我的项目上运行rails generate devise:install。 Bundler抛出了一个错误。 错误如下

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 `' 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 `' 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 `' 

这是我的gem清单

 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) 

当我做rails generate devise:install时,我一直收到错误。 我尝试卸载设计并重新安装它。 我甚至尝试卸载uglifier并重新安装。 我无法理解导致问题的原因是什么? 它是捆绑者吗?

它已经解决了。 问题是nodejs。 我正在使用nvm来管理我的nodejs,我切换到系统范围的sudo apt-get install nodejs并切换到nvm以使用系统版本并设计开始工作。

我遇到了同样的问题,因为我这样做了:

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

当我收到错误时,我发现这三个步骤纠正了这个问题,虽然我不确定如何或为什么:

  1. 卸载gem。
  2. 安装gem,没有特定版本来安装最新版本。
  3. 更新我的gem文件以包含此新版本。

我正在通过文本学习Ruby on Rails,它让我使用特定的版本,但是整个过程没有按照预期的那样工作,我发现上面的内容对我有用。 在事情最终成功之前,我必须为四个gem做这件事。

您的错误的主要原因可能是您忘记在Gemfile包含您的gem 。 所以,

首先检查uglifier gem是否存在于Gemfile中。

之后,再次运行bundle install

然后install设计。

我希望这有帮助。

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

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