After running
mina deploy
I get this error
mina deploy
-----> Creating a temporary build path
-----> Fetching new git commits
-----> Using git branch 'master'
Cloning into '.'...
done.
-----> Using this git commit
root (e1bd364):
> fixes fo rmina
-----> Symlinking shared paths
-----> Installing gem dependencies using Bundler
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Your Gemfile has no gem server sources. If you need gems that are not already on
your machine, add a line like this to your Gemfile:
source 'https://rubygems.org'
Your bundle is locked to rake (12.0.0), but that version could not be found in
any of the sources listed in your Gemfile. If you haven't changed sources, that
means the author of rake (12.0.0) has removed it. You'll need to update your
bundle to a different version of rake (12.0.0) that hasn't been removed in order
to install.
! ERROR: Deploy failed.
-----> Cleaning up build
Unlinking current
OK
Connection to app.com closed.
! Run Error
If I run bundle show rake I see this
/var/lib/gems/2.3.0/gems/rake-12.0.0
I tried looking in app/vendor and bundler is not there. I tried using bundle install and bundle update.
Update:
I checked and source 'https:rubygems.org' is in my gemfile.
I tried running bundle install deployment
bundle install --deployment
and ran into the same error.
Your Gemfile has no gem server sources. If you need gems that are not already on your machine, add a line like this to your Gemfile:
source 'https://rubygems.org'
Seems like there is no gem source specified in your Gemfile
You may try adding this line at the top of your Gemfile
source 'https://rubygems.org'
and then try again
So the issue had to do with permissions and running as root as the error stated.
I had mina and some of the other gem folders under a different user, while deploying as root. Once I cleared up the ownership of files, and added the user as a root user, mina deployed correctly.
Related
I have a Ruby on Rails and Redux/React app I have already pushed dozens of times to heroku via "git push heroku master" and it builds correctly. I recently tried to create a staging environment. After setting the remote, I run
git push staging master
And the webpack portion builds correctly, but once Heroku tries to build the Rails portion I get this error.
remote: ! Could not detect rake tasks
remote: ! ensure you can run `$ bundle exec rake -P` against your app
remote: ! and using the production group of your Gemfile.
remote: ! Activating bundler (2.0.1) failed:
remote: ! Could not find 'bundler' (2.0.1) required by your /tmp/build_687b8b1cf6d6cbb297288640ccb0d405/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'`
To create the staging environment, I ran
heroku create --remote staging
in the root folder of the project.
I also have tried updating the bundler.
bundle update --bundler
&
gem install bundler:2.0.1
I tried precompiling assets as well, but nothing.
RAILS_ENV=production bundle exec rake assets:precompile
I ran
bundle exec rake -P
as suggested, but that did not fix it as well.
Another thing is when I push successfully, in the logs it shows I am using a different ruby version
Using Ruby version: ruby-2.3.4
remote: -----> Installing dependencies using bundler 2.0.2
In the staging logs it shows
Using Ruby version: ruby-2.5.5
remote: -----> Installing dependencies using bundler 2.0.2
Not sure if that helps. But any possible solutions can help!
Thanks!
The solution to issues like these it to ensure all environments (development, staging, production, CI) share the same Ruby version. This will make development and testing much more predictable.
Specify your Ruby version in the Gemfile (this build worked with Ruby 2.3.4, so that's what we'll use):
# Gemfile
ruby '2.3.4'
I'm having trouble pushing my project to Heroku it's telling me I'm missing a gem rake 11.1.2 yet running gem list rake tells me I do have rake 11.1.2 installed.
This issue was resolved by removing vendor/cache from the codebase before pushing to Heroku. This potentially confusing result arises from the differences in behavior exhibited by bundle under different circumstances.
Using bundle at your workstation, the command will exhibit this behavior:
While installing gems, Bundler will check vendor/cache and then your system's gems. If a gem isn't cached or installed, Bundler will try to install it from the sources you have declared in your Gemfile.
This yields the results expected by the OP, a working setup.
The bundle command on Heroku, however, is preparing to run your application under web traffic load, an entirely different set of stresses from development. On Heroku, the bundle command executes with the --deployment flag, which will exhibit this behavior:
If you have run bundle pack, checked in the vendor/cache directory, and do not have any git gems, Bundler will not contact the internet while installing your bundle.
Bundler is making the assumption here, based on the presence of the vendor/cache directory, that the bundle pack command has been run,and the gems are pre-provisioned. Since rake, then, wasn't present in vendor/cache this was the resulting error.
OP may have resolved the issue by either removing the relevant gems from vendor/cache or by issuing the bundle pack command and checking the gems into source control. The first is more common.
I'm learning RoR and trying to deploy my test app to heroku receiving next error:
Unresolved dependencies detected; Installing...
Using --without developmen
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control
You have added to the Gemfile:
* therubyracer (~> 0.9.3.beta1)
* pg
FAILED: http://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
Please! Help!
Have you committed your Gemfile.lock?
bundle install
git add Gemfile.lock
git commit -am "Add lock file"
git push heroku master
This error might be because you did not completely do bundle install.
First do
bundle install
Add gem 'pg' to the gem file and install the postgres gems and postgres on your local machine. If you dont want to install postgres on your local machine then add gem 'pg to production environment and run bundle install without test environment. Though heroku discourages this way of running your application. It is always better to use same database for running locally and in production. Installing postgres is pain but it is worth it.
Your ruby should be 1.9.2.
After installing all the dependencies and post gres on your machine do bundle install and add your gem file to heroku.
git add Gemfile
git add Gemfile.lock
git commit
git push heroku master
I'm tryting to push my RoR 3.1.0.beta1 project up to Heroku from my Git repository using the following command as usual:
git push heroku master
But I am getting the following error:
-----> Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
Installing rails3_disable_x_sendfile... done
-----> Configure Rails to log to stdout
Installing rails_log_stdout... done
-----> Gemfile detected, running Bundler version 1.0.7
Unresolved dependencies detected; Installing...
Using --without development:test
Fetching source index for http://rubygems.org/
Could not find sprockets-2.0.0.beta.2 in any of the sources
FAILED: http://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
My Gemfile has this line:
gem 'sprockets', '2.0.0.beta.2'
Sprockets version 2.0.0.beta.2 exists because I've been pulling different versions including this version. Is there something I'm missing here?
Thanks
Looks like this version has been pulled from Rubygems, only beta.12 and beta.13 are listed:
http://rubygems.org/gems/sprockets
So you'd need to get the specific beta.2 branch from the repo, as Thariq suggests.
BUT, I'd probably go for one of the versions listed on rubygems - there must be good a reason why they were pulled ;)
It's not on rubygems because:
You need to figure out what source you are getting the gem from and add that to the top of your gem file like so:
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem 'sqlite3'
gem 'sprockets', '2.0.0.beta.2'
gem "sprockets", "~> 1.0.2" is on ruby gems. But you will need to find where your versions is specifically hosted such as http://mysite.org add that to the top of your gemfile.
Presumably you've been pulling from the Sprockets Git Repo. You need to tell your Gemfile where you get a gem that's not in rubygems, so in this case you would use:
gem 'sprockets', '2.0.0.beta.2', :git => 'git://github.com/sstephenson/sprockets.git'
As of yesterday, I'm unable to update my bundle. It gets stuck at "Fetching source index for http://rubygems.org/". I know this usually takes a while, but I've waited for hours and tried several times over the last day. I have a 20 Mbit internet connection.
I'm using gem 1.8.5, Bundler version 1.0.15, rvm 0.1.46, ruby-1.9.2-p0 [ x86_64 ] and Rails 3.0.8 on a Macbook. Gemfile: https://gist.github.com/1028832
The reason I'm trying to run Bundle Update is because the bundle was set to rake 0.8.7 until recently (not sure why), but rake started demanding that I move up to 0.9.2. So I changed the Gemfile. Bundle Install tells me to:
bundle install
Fetching source index for http://rubygems.org/
You have requested:
rake >= 0.9.2
The bundle currently has rake locked at 0.8.7.
Try running `bundle update rake`
My .bundle/config contains:
---
BUNDLE_DISABLE_SHARED_GEMS: "1"
BUNDLE_WITHOUT: production
I'm not behind a proxy.
I even tried deleting Gemfile.lock, reinstalling the ruby version in rvm and deleting all gems:
rm Gemfile.lock
rvm uninstall 1.9.2
rvm install 1.9.2
for x in `gem list --no-versions`;do gem uninstall $x -aIx;done
gem install bundle
bundle install
Comment out all gems and set explicit versions for rails (e.g. 3.0.8) and rake (e.g. 0.9.2). Then just run rake, cucumber and the server to see which gems you really need and add them back one by one manually.
I had the same problem with jam at “Fetching source index for http://rubygems.org/”
In my case it was solved by using the rubygems modern index instead of the API endpoint:
bundle install --full-index
I checked the Gemfile.lock and added the specific version (e.g. ~> 1.3.0) to the gems that had none in the Gemfile. Found out to be faster, than uncommenting gem by gem.
By doing the accepted answer and uncommenting gem by gem, I found that the error was due to incompatible gem dependencies. Maybe the resolution algorithm was stuck in a loop.