尝试运行rake assets:precompile RAILS_ENV=production
时出现错误。这是我的Gemfile
:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'httparty'
# Babel
gem 'sprockets-commoner'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'devise'
gem 'activeadmin', github: 'activeadmin'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem "paperclip", "~> 5.0.0"
gem 'bower-rails'
gem "therubyracer"
gem "less-rails"
gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development do
gem "capistrano", "~> 3.8"
gem 'capistrano-rvm', require: false
gem 'capistrano-rails', require: false
gem 'capistrano-bundler', require: false
gem 'capistrano3-unicorn'
end
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
这是错误输出:
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides /extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
(called from block in <class:Railtie> at /home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/less-rails-2.8.0/lib/less/rails/railtie.rb:16)
DEPRECATION WARNING: You are using the a deprecated processor interface Less::Rails::ImportProcessor.
Please update your processor interface:
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
(called from block in <class:Railtie> at /home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/less-rails-2.8.0/lib/less/rails/railtie.rb:21)
** Invoke bower:before_precompile (first_time)
** Execute bower:before_precompile
** Execute assets:precompile
rake aborted!
Sass::SyntaxError: Invalid CSS after "[": expected "|", was "]"
(sass):41
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass /scss/parser.rb:1207:in `expected'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/scss/parser.rb:1137:in `expected'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/scss/parser.rb:1132:in `tok!'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/scss/static_parser.rb:262:in `attrib_name!'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/scss/static_parser.rb:229:in `attrib'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/scss/static_parser.rb:152:in `simple_selector_sequence'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/scss/static_parser.rb:111:in `selector'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/scss/static_parser.rb:86:in `selector_comma_sequence'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/scss/parser.rb:1115:in `expr!'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/scss/static_parser.rb:20:in `parse_selector'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:427:in `visit_rule'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:36:in `visit'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:160:in `block in visit'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/stack.rb:79:in `block in with_base'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/stack.rb:115:in `with_frame'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/stack.rb:79:in `with_base'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:160:in `visit'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:52:in `map'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:52:in `visit_children'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:169:in `block in visit_children'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:181:in `with_environment'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:168:in `visit_children'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:36:in `block in visit'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:188:in `visit_root'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:36:in `visit'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:159:in `visit'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:8:in `visit'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/root_node.rb:36:in `css_tree'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/tree/root_node.rb:20:in `render'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sass-3.4.23/lib/sass/engine.rb:281:in `render'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/sass_compressor.rb:48:in `call'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/sass_compressor.rb:28:in `call'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `call_processors'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in `block in load'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in `load'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:in `find_asset'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:142:in `block in find'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `each'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `each'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `logical_paths'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:140:in `find'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:185:in `compile'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-3.7.1/lib/rake/sprocketstask.rb:147:in `with_logger'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/home/efrain/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/bin/rake:23:in `load'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/bin/rake:23:in `<main>'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/bin/ruby_executable_hooks:15:in `eval'
/home/efrain/.rvm/gems/ruby-2.3.1@xxxx/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => assets:precompile
我正在使用ruby 2.3.1和Rails 5.0.1
我搜索了类似的帖子,但他们没有帮我解决问题。 我会非常感激任何帮助。
答案 0 :(得分:0)
这是一个非常具体的案例,但也许它可以帮助某人。
该项目使用一个名为Polo的html主题,这使用Bootstrap所以在bootstrap.min.css
中存在有问题的语法,如下所示:[] { cursor: pointer; }
所以我摆脱它。为了获取该文件,我开始对application.css
文件中的行进行注释,以了解导致问题的需求。