ruby-on-rails - Devise 在运行 devise :install in rails application 时出错

标签 ruby-on-rails ruby devise

我正在使用 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 `<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>'

这是我的 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)

当我执行 rails generate devise:install 时,我不断收到错误消息。我尝试卸载设计并重新安装它。我什至尝试卸载 uglifier 并重新安装。我无法理解是什么导致了这个问题?是 bundler 吗?

最佳答案

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

关于ruby-on-rails - Devise 在运行 devise :install in rails application 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34294450/

相关文章:

ruby-on-rails - 导航大型 ruby​​ 代码库,如 rails

JavaScript 调用方法不适用于 OwlCarousel-Rails

ruby-on-rails - 使用 Ruby on Rails 在 URL 中包含 belongs_to 模型对象的名称

ruby-on-rails - rake 数据库 :seed before db:migrate

ruby-on-rails - 使用子文件夹中的 Controller 设计 UninitializedConstant ApplicationController

ruby-on-rails-3 - 防止在 Rails 3.2.2 上为 RESTful api 创建 session

ruby-on-rails - RubyOnRails 设计的单点登录策略

ruby-on-rails - 找不到 ` 没有 ID

ruby-on-rails - 设计:注册登录尝试

ruby-on-rails - 重定向后的验证消息