我处在一个不可行的情况,我必须在ubuntu服务器上部署一个ruby one rail应用程序,没有任何文档,也没有ruby(或ruby on rails)的经验。
我尝试按照各种论坛/教程中列出的步骤进行操作。我已经在端口80上启动了WEBricks服务器,但是当我尝试从浏览器访问Web应用程序时,我得到以下内容而不是浏览器。
couldn't find file './compiled/admin' under '/home/ubuntu/www/my-app/app/assets/stylesheets' with type 'text/css'
然后有人建议我跑
rake assets:precompile
当我运行此命令时,出现以下错误...
DEPRECATION WARNING: Currently, Active Record suppresses errors raised within `after_rollback`/`after_commit` callbacks and only print them to the logs. In the next version, these errors will no longer be suppressed. Instead, the errors will propagate normally just like in other Active Record callbacks.
You can opt into the new behavior and remove this warning by setting:
config.active_record.raise_in_transactional_callbacks = true
(called from <class:User> at /home/ubuntu/www/my-app/app/models/user.rb:27)
rake aborted!
Sprockets::FileNotFound: couldn't find file './compiled/admin' under '/home/ubuntu/www/my-app/app/assets/stylesheets' with type 'text/css'
/home/ubuntu/www/my-app/app/assets/stylesheets/admin.css:10
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/resolve.rb:64:in `resolve!'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/directive_processor.rb:399:in `resolve'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/directive_processor.rb:207:in `process_require_directive'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/directive_processor.rb:180:in `block in process_directives'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/directive_processor.rb:178:in `each'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/directive_processor.rb:178:in `process_directives'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/directive_processor.rb:83:in `_call'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/directive_processor.rb:68:in `call'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:86:in `load_asset_by_uri'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:45:in `block in load'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:155:in `fetch_asset_from_dependency_cache'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:38:in `load'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/cached_environment.rb:47:in `load'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/bundle.rb:23:in `block in call'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/utils.rb:183:in `dfs'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/bundle.rb:24:in `call'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:86:in `load_asset_by_uri'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:45:in `block in load'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:155:in `fetch_asset_from_dependency_cache'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/loader.rb:38:in `load'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/cached_environment.rb:47:in `load'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/base.rb:63:in `find_asset'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/base.rb:70:in `find_all_linked_assets'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/manifest.rb:130:in `block in find'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/manifest.rb:129:in `each'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/manifest.rb:129:in `find'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/sprockets/manifest.rb:162:in `compile'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-3.2.0/lib/rake/sprocketstask.rb:147:in `with_logger'
/home/ubuntu/.rvm/gems/ruby-2.3.0/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
任何帮助都感激不尽。如果您希望我提供任何其他信息,请询问。
以下是app / assets / stylesheets / admin.css文件
/*
* Admin stylesheets
*
*= require select2
*= require select2-bootstrap
*= require_tree ./plugins
*= require_tree ./fonts
*
* Pull compiled from /app/assets/stylesheets/compiled
*= require ./compiled/admin
*
*/
Gemfile看起来像这样。
source 'https://rubygems.org'
gem 'rails', '4.2.0'
gem 'sass-rails', '~> 5.0.3'
gem 'less-rails', '~> 2.7.0'
gem 'therubyracer'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'sqlite3', group: :development
gem 'pg'
#bootstrap components
gem 'bootstrap-datepicker-rails'
gem "select2-rails"
#images upload
gem "paperclip", "~> 4.2"
gem 'aws-sdk', '~> 1.6'
group :development do
gem 'capistrano', '~> 2'
gem 'spring'
gem 'better_errors'
gem 'binding_of_caller'
gem 'pry'
gem 'pry-rails'
gem 'awesome_print' # https://github.com/michaeldv/awesome_print
end
gem 'rails_12factor', group: [:production, :staging]
#user managment
gem 'devise'
gem 'cancancan', '~> 1.10'
gem 'recaptcha', require: 'recaptcha/rails'
#tracking user data
gem 'classy_enum'
#pagination
gem 'kaminari'
#api serialization
gem 'active_model_serializers'
# To use Jbuilder templates for JSON
gem 'jbuilder'
#dropbox
gem "dropbox-api"
#sidekiq jobs
gem 'sidekiq'
gem 'sidekiq-status'
gem 'sinatra', :require => nil
#for the folders hierarchy tree
gem 'closure_tree'
# PDFs
gem 'doc_raptor'
# Excel Parsing
gem 'roo'
# Emails
gem 'sendgrid'
# auto increment numbers
gem 'protokoll'
# State machine
gem 'aasm'
#elastic search
gem 'elasticsearch-model', git: 'git://github.com/elasticsearch/elasticsearch-rails.git'
gem 'elasticsearch-rails', git: 'git://github.com/elasticsearch/elasticsearch-rails.git'
gem 'rubyzip'
gem 'exception_notification', group: [:production, :staging], github: 'joshco/exception_notification'
gem 'spreadsheet'
app文件夹中的文件列表
drwxrwxr-x 11 ubuntu ubuntu 4096 Apr 1 08:03 app
drwxrwxr-x 2 ubuntu ubuntu 4096 Apr 1 08:03 bin
drwxrwxr-x 3 ubuntu ubuntu 4096 Apr 1 08:03 client
drwxrwxr-x 5 ubuntu ubuntu 4096 Apr 5 22:08 config
-rw-rw-r-- 1 ubuntu ubuntu 153 Apr 1 08:03 config.ru
drwxrwxr-x 4 ubuntu ubuntu 4096 Apr 1 08:03 db
-rw-rw-r-- 1 ubuntu ubuntu 1570 Apr 1 08:03 Gemfile
-rw-rw-r-- 1 ubuntu ubuntu 9072 Apr 1 08:03 Gemfile.lock
drwxrwxr-x 5 ubuntu ubuntu 4096 Apr 1 08:03 gulp
-rw-rw-r-- 1 ubuntu ubuntu 557 Apr 1 08:03 gulpfile.js
drwxrwxr-x 6 ubuntu ubuntu 4096 Apr 1 08:03 lib
drwxrwxr-x 2 ubuntu ubuntu 4096 Apr 6 13:48 log
-rw-rw-r-- 1 ubuntu ubuntu 1393 Apr 1 08:03 package.json
-rw-rw-r-- 1 ubuntu ubuntu 146 Apr 1 08:03 Procfile
-rw-rw-r-- 1 ubuntu ubuntu 143 Apr 1 08:03 Procfile.example
drwxrwxr-x 2 ubuntu ubuntu 4096 Apr 1 08:03 public
-rw-rw-r-- 1 ubuntu ubuntu 249 Apr 1 08:03 Rakefile
-rw-rw-r-- 1 ubuntu ubuntu 7908 Apr 1 08:03 README.md
drwxrwxr-x 8 ubuntu ubuntu 4096 Apr 1 08:03 test
drwxrwxr-x 6 ubuntu ubuntu 4096 Apr 5 15:14 tmp
drwxrwxr-x 3 ubuntu ubuntu 4096 Apr 1 08:03 vendor
-rw-rw-r-- 1 ubuntu ubuntu 64 Apr 1 08:03 webpack.config.js
答案 0 :(得分:1)
您的问题是您需要生成将放在此stylesheets/compiled
文件夹中的文件。
两个选项:
了解如何生成它们(如果您有关于bower,grunt等的文件,请查看项目的根目录。如果您这样做,我需要启动它们以实际生成文件并在资产编译之前添加相应的部署规则或提交结果。
从admin.css
文件中删除此行:
*= require ./compiled/admin