无法在rails web app上生成上传器图片

时间:2015-11-18 10:06:22

标签: ruby-on-rails ruby rubygems uploader

我跟随michael hartl的轨道教程并陷入了第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

我运行了捆绑包并安装了宝石而没有遇到任何麻烦。但是当我试图运行时

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回滚我的应用程序再次尝试,但没有效果。

这里的任何人都知道发生了什么以及如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

将此行添加到您的Gemfile并再次`Welcome to Node-RED 18 Nov 10:05:56 - [info] Node-RED version: v0.11.1 18 Nov 10:05:56 - [info] Node.js version: v0.10.32 18 Nov 10:05:56 - [info] Loading palette nodes 18 Nov 10:05:57 - [warn] ------------------------------------------ 18 Nov 10:05:57 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node 18 Nov 10:05:57 - [warn] [tail] Not currently supported on Windows. 18 Nov 10:05:57 - [warn] ------------------------------------------ 18 Nov 10:05:57 - [info] Settings file : c:\Users\Me\workspace_nodeRed\NodeRe dTuts\node-red-0.11.1\settings.js 18 Nov 10:05:57 - [info] User directory : C:/Users/Me/workspace_nodeRed/NodeRe dTuts/node-red-0.11.1 18 Nov 10:05:57 - [info] Flows file : c:\Users\Me\workspace_nodeRed\NodeRedTut s\node-red-0.11.1\flows.json 18 Nov 10:05:57 - [info] Server now running at http://127.0.0.1:1854/ 18 Nov 10:05:57 - [info] Starting flows 18 Nov 10:05:57 - [info] [inject:fd665561.0299a8] repeat = 300000 18 Nov 10:05:57 - [info] Started flows`

bundle install