无法在 rails 网络应用程序上生成上传器图片
Cannot generate uploader Picture on rails web app
我正在关注 michael hartl 的 railstutorial 并卡在了第 11 章,他在那里实现了图像的上传。将我的 gemfile 更新为
后
source 'https://rubygems.org'
gem 'rails', '4.2.4'
gem 'sqlite3'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '~> 4.1.0'
gem 'bootstrap-sass', '3.2.0.0'
gem 'bcrypt', '3.1.7'
gem 'faker', '1.4.2'
gem 'carrierwave', '0.10.0'
gem 'mini_magick', '3.8.0'
gem 'fog', '1.26.0'
gem 'will_paginate', '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '~> 2.2.3'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'byebug', '3.4.0'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end
group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
end
我运行 bundle 和 gems 安装没有问题。但是当我尝试 运行
rails generate uploader Picture
我收到以下消息:
/home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/fog-1.26.0/lib/fog/joyent/compute.rb:3:in `require': cannot load such file -- net/ssh (LoadError)
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/fog-1.26.0/lib/fog/joyent/compute.rb:3:in `<top (required)>'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/fog-1.26.0/lib/fog/joyent.rb:1:in `require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/fog-1.26.0/lib/fog/joyent.rb:1:in `<top (required)>'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/fog-1.26.0/lib/fog.rb:41:in `require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/fog-1.26.0/lib/fog.rb:41:in `<top (required)>'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave/storage/fog.rb:3:in `require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave/storage/fog.rb:3:in `<top (required)>'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave/storage.rb:9:in `require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave/storage.rb:9:in `<top (required)>'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave.rb:78:in `require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave.rb:78:in `<top (required)>'
user@ubuntuServer:/media/sf_ubuntu/hello_world$ from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
到目前为止,我已经尝试过更改 gem 的版本,并且 运行 进行了捆绑更新,但没有任何效果。我什至尝试使用 git 回滚我的应用程序再试一次,但没有效果。
这里有人知道发生了什么以及如何解决它吗?
将此行添加到您的 Gemfile 中并bundle install
再次:
gem 'net-ssh'
我正在关注 michael hartl 的 railstutorial 并卡在了第 11 章,他在那里实现了图像的上传。将我的 gemfile 更新为
后source 'https://rubygems.org'
gem 'rails', '4.2.4'
gem 'sqlite3'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '~> 4.1.0'
gem 'bootstrap-sass', '3.2.0.0'
gem 'bcrypt', '3.1.7'
gem 'faker', '1.4.2'
gem 'carrierwave', '0.10.0'
gem 'mini_magick', '3.8.0'
gem 'fog', '1.26.0'
gem 'will_paginate', '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '~> 2.2.3'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'byebug', '3.4.0'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end
group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
end
我运行 bundle 和 gems 安装没有问题。但是当我尝试 运行
rails generate uploader Picture
我收到以下消息:
/home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/fog-1.26.0/lib/fog/joyent/compute.rb:3:in `require': cannot load such file -- net/ssh (LoadError)
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/fog-1.26.0/lib/fog/joyent/compute.rb:3:in `<top (required)>'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/fog-1.26.0/lib/fog/joyent.rb:1:in `require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/fog-1.26.0/lib/fog/joyent.rb:1:in `<top (required)>'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/fog-1.26.0/lib/fog.rb:41:in `require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/fog-1.26.0/lib/fog.rb:41:in `<top (required)>'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave/storage/fog.rb:3:in `require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave/storage/fog.rb:3:in `<top (required)>'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave/storage.rb:9:in `require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave/storage.rb:9:in `<top (required)>'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave.rb:78:in `require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave.rb:78:in `<top (required)>'
user@ubuntuServer:/media/sf_ubuntu/hello_world$ from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
到目前为止,我已经尝试过更改 gem 的版本,并且 运行 进行了捆绑更新,但没有任何效果。我什至尝试使用 git 回滚我的应用程序再试一次,但没有效果。
这里有人知道发生了什么以及如何解决它吗?
将此行添加到您的 Gemfile 中并bundle install
再次:
gem 'net-ssh'