"Unexpected token: name (closeBootstrapDatepicker)" during a rails deployment - heroku

When deploying a rails 5 application, I get this error:
remote: Bundle completed (3.85s)
remote: Cleaning up the bundler cache.
remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: The latest bundler is 1.16.3, but you are currently running 1.15.2.
remote: To update, run `gem install bundler`
remote: -----> Installing node-v8.10.0-linux-x64
remote: -----> Installing yarn-v1.5.1
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: yarn install v1.5.1
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: info fsevents#1.2.0: The platform "linux" is incompatible with this module.
remote: info "fsevents#1.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: [3/4] Linking dependencies...
remote: warning "#rails/webpacker > postcss-cssnext#3.1.0" has unmet peer dependency "caniuse-lite#^1.0.30000697".
remote: warning " > webpack-dev-server#2.11.2" has unmet peer dependency "webpack#^2.2.0 || ^3.0.0".
remote: warning "webpack-dev-server > webpack-dev-middleware#1.12.2" has unmet peer dependency "webpack#^1.0.0 || ^2.0.0 || ^3.0.0".
remote: [4/4] Building fresh packages...
remote: Done in 24.80s.
remote: I, [2018-07-31T05:34:58.372842 #459] INFO -- : Writing /tmp/build_e0b626d68337f6bf487c3718057509da/public/assets/placeholder-d28a0c1aa165374509a6d251adb89aa4c9f688dd2da914d199252b60f278a3fd.png
remote: rake aborted!
remote: Uglifier::Error: Unexpected token: name (closeBootstrapDatepicker). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).
remote: /tmp/build_e0b626d68337f6bf487c3718057509da/vendor/bundle/ruby/2.5.0/gems/uglifier-4.1.10/lib/uglifier.rb:234:in `parse_result'
r
My platform is heroku. How do I fix it?
This application used to deploy fine.

Related

How do I fix a Bundler Conflict when pushing to Heroku?

I'm attempting to deploy a Sinatra app to Heroku. Everything works locally. However I get an issue with bundler when I try to push it successfully to Heroku.
I've tried to delete the Gemfile lock and then the following
bundle update
git add .
git push "Gemfile.lock"
git push heroku master
gem install bundler:2.0.1
bundle install
git add .
git push "Gemfile.lock"
git push heroku master
bundle update --bundler
git add .
git push "Gemfile.lock"
git push heroku master
Here is my gemfile
source "https://rubygems.org"
# gem "rails"
gem 'sinatra'
gem 'activerecord', '~> 5.2', '>= 5.2.2.1'
gem 'rake'
gem 'sinatra-activerecord'
gem 'require_all'
gem 'bcrypt'
gem 'rack-flash3'
gem 'rb-readline'
group :development, :test do
gem 'sqlite3'
gem 'shotgun'
gem 'pry'
end
group :production do
gem 'pg'
end
Here are the error messages
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rack
remote: -----> Using Ruby version: ruby-2.5.5
remote: -----> Installing dependencies using bundler 2.0.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Activating bundler (2.0.1) failed:
remote: Could not find 'bundler' (2.0.1) required by your /tmp/build_77505ef74596fc4dddd66c8b792d759b/Gemfile.lock.
remote: To update to the latest version installed on your system, run `bundle update --bundler`.
remote: To install the missing version, run `gem install bundler:2.0.1`
remote: Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information
remote:
remote: To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
remote: Bundler Output: Activating bundler (2.0.1) failed:
remote: Could not find 'bundler' (2.0.1) required by your /tmp/build_77505ef74596fc4dddd66c8b792d759b/Gemfile.lock.
remote: To update to the latest version installed on your system, run `bundle update --bundler`.
remote: To install the missing version, run `gem install bundler:2.0.1`
remote: Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information
remote:
remote: To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to infinite-waters-69714.
remote:
To https://git.heroku.com/infinite-waters-69714.git
! [remote rejected] master -> master (pre-receive hook declined)
Additionally, I've tried to remove sqlite3 altogether and repeat the above processes.
Any ideas on how to fix this?
I've ran into this issue some time ago: I contacted Heroku and they told me they have a locked version of Bundler, so your only option is to use the Bundler version they use:
gem uninstall bundler
gem install bundler -v 2.0.2
bundle update

Deploying on Heroku, how to specify ruby version to use for bundler?

Something has changed recently on Heroku. I can't deploy my app as I've done before:
me#host my-project (master) $ git push staging master
Counting objects: 52, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (51/51), done.
Writing objects: 100% (52/52), 159.47 KiB | 0 bytes/s, done.
Total 52 (delta 42), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Deleting 4 files matching .slugignore patterns.
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.3.0
remote: -----> Installing dependencies using bundler 1.13.6
remote: Your app was upgraded to bundler 1.13.6.
remote: Previously you had a successful deploy with bundler 1.11.2.
remote:
remote: If you see problems related to the bundler version please refer to:
remote: https://devcenter.heroku.com/articles/bundler-version
remote: Ruby version change detected. Clearing bundler cache.
remote: Old: ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
remote: New: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Your Ruby version is 2.3.0, but your Gemfile specified 2.2.0
remote: Bundler Output: Your Ruby version is 2.3.0, but your Gemfile specified 2.2.0
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to my-project-staging.
remote:
To https://git.heroku.com/my-project-staging.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/my-project-staging.git'
I don't get it, i'm using ruby 2.2.0 since the beginning:
me#host my-project (master) $ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
me#host my-project (master) $ cat .ruby-version
2.2.0
me#host my-project (master) $ cat Gemfile | grep 'ruby'
ruby '2.2.0'
I don't know how to tell bundler I'm still using ruby 2.2.0. My bundler have this in the bottom:
RUBY VERSION
ruby 2.3.0p0
BUNDLED WITH
1.12.1
Why bundler doesn't use the ruby 2.2.0 version? It's using 2.3.0 instead...
Check your Gemfile.lock. Recent versions of bundler add both the ruby version and bundler version that were used install the gems (and generate the Gemfile.lock).
At the bottom you'll find:
RUBY VERSION
ruby 2.3.0
BUNDLED WITH
1.13.1 # or whatever version of bundler you're using
Remove this, and re-run bundle install with the correct version of ruby - you may need to remove + re-add a gem to trigger a re-build of the Gemfile.lock file.
Finally I add to remove bundler and install the same version as Heroku.
Sometimes bundler doesn't generate in Gemfile.lock
RUBY VERSION
ruby 2.x.x
In that case, just add that entry manually inside the Gemfile.lock file commit and push it to master. Heroku will take that version and build.

Bundle install fails on windows

Installing Heroku on Windows 8.1 on Ruby, "bundle install" fails with the following error.
All dependencies have been install.
How can I fix this?
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.4.2
Using i18n 0.7.0
Installing json 1.8.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

FreeTDS buildpack on Heroku Cedar OpenSSL Error

I have a sinatra rack ruby app that I want to deploy on heroku. The app needs to connect to an SQL Server Database. For that I need the TinyTds gem.
Gemfile
source 'http://rubygems.org'
ruby "1.9.3"
gem 'sinatra'
gem 'tiny_tds'
Gemfile.lock after bundle install
GEM
remote: http://rubygems.org/
specs:
rack (1.6.0)
rack-protection (1.5.3)
rack
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
tilt (1.4.1)
tiny_tds (0.6.2)
PLATFORMS
ruby
DEPENDENCIES
sinatra
tiny_tds
TinyTds requires FreeTDS which heroku doesn't have apparently. So there are some crazy solutions on the internet with static compiles in heroku-similar VMs and stuff like that. The most reasonable solution was to set a custom buildpack for my app that includes FreeTDS:
heroku create my_new_app --buildpack https://github.com/firmhouse/heroku-buildpack-ruby-freetds.git
However
$ git push heroku master
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching custom git buildpack... done
remote: -----> Ruby/Rack app detected
remote: Installing freetds into /tmp/build_7b7e059c43475a97d6c091bcf9162e16/vendor/freetds
remote:
remote: % Total % Received % Xferd Average Speed Time Time Time Current
remote: Dload Upload Total Spent Left Speed
remote: 100 3590k 100 3590k 0 0 17.8M 0 --:--:-- --:--:-- --:--:-- 17.8M
remote:
remote: -----> Using Ruby version: ruby-1.9.3
remote: -----> Installing dependencies using Bundler version 1.7.12
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
remote: Could not load OpenSSL.
remote: You must recompile Ruby with OpenSSL support or change the sources in your
remote: Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using
remote: RVM are available at http://rvm.io/packages/openssl.
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby/Rack app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to my_new_app.
remote:
To https://git.heroku.com/my_new_app.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/my_new_app.git'
Edit: My question is how do I get heroku to work with tiny_tds.

Bundle fails, undefined method `ruby' when deploying to heroku

I'm trying to deploy a Rack app to heroku and it's failing on the bundle step:
-----> Fetching custom git buildpack... done
-----> Ruby/Rack app detected
-----> Using RUBY_VERSION: ruby-1.9.3-p0
-----> Installing dependencies using Bundler version 1.1.rc.7
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
/tmp/build_158s9o0ec0gdk/Gemfile:2:in `evaluate': undefined method `ruby' for #<Bundler::Dsl:0x00000001c7c418> (NoMethodError)
(...)
/app/bin/bundle:23:in `load'
/app/bin/bundle:23:in `<main>'
There was an error in your Gemfile, and Bundler cannot continue.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rack app
The failure is undefined method 'ruby' for #<Bundler::Dsl:0x00000001c7c418> (NoMethodError)
This comes from my Gemfile
source 'https://rubygems.org'
ruby '2.0.0'
I assume it's being caused by the fact that that method wasn't added to Bundler until version 1.2 and heroku seems to be using version 1.1.rc.7.
I don't know how to upgrade the heroku version of bundler. I'm already on the Cedar stack.
The log says Fetching custom git buildpack – it looks like you’re using a custom buildpack, which might explain why the old version of Bundler is being used.
Does
heroku config:get BUILDPACK_URL
show anything? You might just need to stop using the custom buildpack, try
heroku config:unset BUILDPACK_URL
to clear the config var and revert to the normal buildpack.

Resources