Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Uglifier:Heroku上的推送失败-Rails 5.2.3_Ruby On Rails_Ruby_Heroku_Push_Uglifier - Fatal编程技术网

Ruby on rails Uglifier:Heroku上的推送失败-Rails 5.2.3

Ruby on rails Uglifier:Heroku上的推送失败-Rails 5.2.3,ruby-on-rails,ruby,heroku,push,uglifier,Ruby On Rails,Ruby,Heroku,Push,Uglifier,我试图在Heroku上部署没有数据库的应用程序,但我在Uglifier上遇到了以下错误: rake aborted! Uglifier::Error: Unexpected token: keyword (const). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true). /tmp/build_03ed840249175186eece9eb6563a8337/app/as

我试图在Heroku上部署没有数据库的应用程序,但我在Uglifier上遇到了以下错误:

rake aborted!
Uglifier::Error: Unexpected token: keyword (const). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).

/tmp/build_03ed840249175186eece9eb6563a8337/app/assets/config/manifest.js:2

/tmp/build_03ed840249175186eece9eb6563a8337/vendor/bundle/ruby/2.5.0/gems/uglifier-4.1.20/lib/uglifier.rb:234:in `parse_result'
按照建议,我在production.rb中替换了

config.assets.js_compressor = :uglifier

但是,我在推动它时遇到了这个问题:

rake aborted!
Uglifier::Error: Unexpected character '#'     

/tmp/build_c9603da773e8afa6c70b30bb536a85ab/vendor/bundle/ruby/2.5.0/gems/uglifier-4.1.20/lib/uglifier.rb:234:in `parse_result'       

/tmp/build_c9603da773e8afa6c70b30bb536a85ab/vendor/bundle/ruby/2.5.0/gems/uglifier-4.1.20/lib/uglifier.rb:216:in `run_uglifyjs' 
经过一些搜索,这个建议似乎和我在制作中做的完全一样

当我跑的时候

RAILS_ENV=production rake assets:precompile --trace
我没有任何错误

这是我的档案:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.1'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.2'
# Use pg/don't use it
#gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 4.1.20'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# 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', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # 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

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of chromedriver to run system tests with Chrome
  gem 'chromedriver-helper'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

#Style
gem 'bootstrap', '~> 4.3.1'
gem 'jquery-rails', '~> 4.3.3', '>= 4.3.3'
gem 'font-awesome-sass', '~> 5.8.1'

感谢您的回答

不是对您问题的直接回答,但是您是否尝试过在JS资产中搜索意外使用的
#
?我猜你试图在某个地方写评论,并使用ruby
语法而不是JS
/
语法。你的heroku应用程序运行的环境是什么?您应该切换到“rails资产:预编译”,也许这不能解决问题,但是尝试使用
gem'sassc-rails'
而不是gem
'sass-rails'
谢谢您的回答!!!我检查了我所有的js文件,在搜索一个
#
,没有找到任何文件。试图改变sassc的宝石,也没有奏效…我编辑了我的问题,一步一步推。我的问题可能在于我的资产。rb
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.1'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.2'
# Use pg/don't use it
#gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 4.1.20'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# 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', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # 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

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of chromedriver to run system tests with Chrome
  gem 'chromedriver-helper'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

#Style
gem 'bootstrap', '~> 4.3.1'
gem 'jquery-rails', '~> 4.3.3', '>= 4.3.3'
gem 'font-awesome-sass', '~> 5.8.1'
Rails.application.config.assets.precompile += [/.*\.png/,/.*\.ico/,/.*\.jpg/,/.*\.js/,/.*\.scss/,/.*\.svg/]
Rails.application.config.assets.precompile << %w( *.scss *.js )
Rails.application.config.assets.paths << Rails.root.join("lib")
Rails.application.config.assets.paths << Rails.root.join("vendor")
rake aborted!
       Closure::Error: sh: 1: java: not found
       /tmp/build_e1adeef66970d059737b424179dfef90/app/assets/config/manifest.js:2
       /tmp/build_e1adeef66970d059737b424179dfef90/vendor/bundle/ruby/2.5.0/gems/closure-compiler-1.1.14/lib/closure/compiler.rb:68:in `compile_files'