No such file to load -- json (LoadError) - ruby

Everything was working fine on this app, and now today I get this when I try to push to Heroku:
Counting objects: 28, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (22/22), done.
Writing objects: 100% (22/22), 2.20 KiB, done.
Total 22 (delta 14), reused 0 (delta 0)
/app/slug-compiler/lib/slug.rb:12:in `require': no such file to load -- json (LoadError)
from /app/slug-compiler/lib/slug.rb:12
from /app/slug-compiler/bin/slugc:14:in `require'
from /app/slug-compiler/bin/slugc:14
To git#heroku.com:cold-night-9597.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:server-name-1234.git'
Very strange - couldn't find anything on this error anywhere - and its running fine locally...

Try this:
require 'rubygems'
require 'json'

See this answer for details.
I had the same error while running project managed via bundle:
bundle exec jekyll build
The following line was missing in Gemfile:
gem "json"

Related

Why is there an error when I try and commit my bot?

I'm using heroku and I'm trying to deploy my files but I keep getting this error:
$ git push heroku master
Enumerating objects: 13, done.
Counting objects: 100% (13/13), done.
Delta compression using up to 16 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (13/13), 1.75 KiB | 893.00 KiB/s, done.
Total 13 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to botver2554.
remote:
To https://git.heroku.com/botver2554.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/botver2554.git'
Can I have some help?
This is different from the suggested questions because I'm getting a buildpack error, and I don't know what it is.
It was the stupidest thing. I watched an outdated tutorial that said put no extension after requirements then I looked that you needed a requirements.txt file to continue.

ruby how to create gemfile / gemfile.lock

I am hobbyist coder. I created a twitch chat bot and now am trying deploy it Heroku. I wrote this code with ruby without rails and I don't have any gemfile or etc. its works fine on my machine but I don't know how to create for Heroku
I tried like that and I had this error:
Enumerating objects: 18, done.
Counting objects: 100% (18/18), done.
Delta compression using up to 16 threads
Compressing objects: 100% (14/14), done.
Writing objects: 100% (18/18), 4.87 KiB | 997.00 KiB/s, done.
Total 18 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/ruby.tgz
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to stormy-refuge-29575.
remote:
To https://git.heroku.com/stormy-refuge-29575.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/stormy-refuge-29575.git'
github link:https://github.com/sydneyfunnelAIO/twitch-bot
All the gems that you are using in your application should be present in the Gemfile. The reason why the app is running on your computer might be that you have those gem installed globally.
Because you are using rufus-scheduler, selenium-webdriver gems, both should be present in the Gemfile, that should look like this:
source 'https://rubygems.org'
gem 'rufus-scheduler'
gem 'selenium-webdriver'
Once your Gemfile exists, run command bundle install that will install the gems and create Gemfile.lock file.
If it's in ruby you just need to do
bundle install

Gemfile.lock required. Please check it in

Counting objects: 11, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (11/11), 3.82 KiB | 1.91 MiB/s, done.
Total 11 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/NoLockfile
remote:
remote: !
remote: ! Gemfile.lock required. Please check it in.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to aqueous-reaches-83684.
remote:
To https://git.heroku.com/aqueous-reaches-83684.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/aqueous-reaches-83684.git'
I want to launch my application on heroku
I always have one and the same mistake:
Gemfile.lock required. Please check it in.
I did everything according to the instructions! Deleted, downloaded, does not work anyway
Used
bundle install
Still the same error
Make sure you add your Gemfile.lock to source control.
Considering you are on master branch:
git add Gemfile.lock
git commit -m "Commit Gemfile.lock"
git push heroku master
Otherwise:
git push heroku current_branch:master
If it doesn't work, you probably have it ignored in your .gitignore file.
Remove Gemfile.lock or *.lock from your ignored list and repeat the commands above.

Heroku Push Rejected for Rails 2.3.5

I am trying to push my app up to Heroku, but am getting rejected. Here is the error message I'm getting.
Counting objects: 63, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (56/56), done.
Writing objects: 100% (63/63), 80.06 KiB, done.
Total 63 (delta 10), reused 0 (delta 0)
-----> Heroku receiving push
! Heroku push rejected, no Cedar-supported app detected
To git#heroku.com:agile-shelf-2850.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:agile-shelf-2850.git'
My app is the simple hello world app and I am using the following:
Rails 2.3.5
Ruby 1.8.7
Gems 1.4.2
I've research the site and found others that have this problem but they are using Rails 3. Example: Heroku push rejected, no Cedar-supported app detected
Any ideas? I'm using these older versions as the project i'm trying to integrate into is using these versions so i'm trying to stay consistent.
You need to move your config.gem lines in your config/environment.rb to a Gemfile and install bundler. Rails 2.x does not have inherent support of Bundler and Cedar requires that you use Bundler to specify your app's gem dependencies. Otherwise it will not see your app as a Rails app.
Install Bundler for Rails 2.3 via:
http://gembundler.com/v1.3/rails23.html
If you have further problems afterwards let us know!

Error Pushing To Heroku, Rails3 beta4

i'm getting an error when pushing to heroku using rails 3 beta 4. i've
managed to deploy before using it but for some reason i'm getting a
strange error now.
I'm on os x, snow leopard. I've been using rvm with both 1.9.2 preview
and head, i also just reverted back to the system ruby 1.8.7 -p254 but
they all give me the same error:
--------------------------------------------------------------------------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- ---------------------
git push heroku master
Counting objects: 334, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (285/285), done.
Writing objects: 100% (310/310), 48.73 KiB, done.
Total 310 (delta 119), reused 0 (delta 0)
-----> Heroku receiving push
-----> Rails app detected
-----> Gemfile detected, running Bundler
Unresolved dependencies detected; Installing...
.........
.........
INSTALLS/BUNDLES ALL THE GEMS AND EVERYTHING WORKS FINE UNTILL HERE:
.........
.........
Your bundle is complete! Use `bundle show [gemname]` to see where a
bundled gem is installed.
Locking environment
/usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/package/
tar_input.rb:49:in `initialize': not in gzip format
(Zlib::GzipFile::Error)
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/package/
tar_input.rb:49:in `new'
.........
.........
MORE STACK TRACE HERE:
.........
.........
error: hooks/pre-receive exited with error code 1
To g...#heroku.com:hostelizer.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '...#heroku.com:hostelizer.git'
--------------------------------------------------------------------------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- ---------------------
Any ideas would be gr8 as i'm not a guru with ruby/rails.
Cheers.

Resources