Rails C and Rails S not working when in the correct directory.
have tried:
$ bundle exec rake rails:update:bin
this returns the following error:
bundler: command not found: rails:update:bin
Install missing gem executables with `bundle install`
I have ran:
Bundle Install
this still returns the same error
Have changed directories (higher and lower), repeated steps and attempted commends for same result.
I was running rails server, when i stopped the server and tried to restart server, the error appeared, so I'm thinking this has something to do with a physical location change (potentially the bin file), which is consistent as when I try and run a bin/rails command, i'm receiving an error of:
bundler: command not found: rails:update:bin
Install missing gem executables with `bundle install`
I have tried to rake the bin folder as below:
rake rails:update:bin
however I am receiving this error:
rake aborted!
Don't know how to build task 'rails:update:bin' (see --tasks)
Finally, I have checked the physical location and there is a .bin file, however this folder is empty and it's not in a .gitignore directory.
Ancillary information
Rails version: 5.1.4
ruby version: 2.3.4
Server: heroku
OS. Ubuntu 16.04 (via virtualbox).
I have not upgraded rails, this is a fresh install
I am at a loss.
rails update:bin or rake update:bin These are the right ways that execute a rake task.
Related
I have a previously deployed Ruby on Rails API that I wanted to add some additional seed data to.
I am getting the following error when I deploy from either the Heroku CLI or from the web interface:
-----> Ruby app detected
-----> Installing bundler 2.0.2
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.6.5
-----> Installing dependencies using bundler 2.0.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
bash: /tmp/build_9062c7d5995d7f7c573d9509eb8f19d5/bin/bundle: cannot execute binary file: Exec format error
Bundler Output: bash: /tmp/build_9062c7d5995d7f7c573d9509eb8f19d5/bin/bundle: cannot execute binary file: Exec format error
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby app.
! Push failed
I am not sure what the issue is. I have tried:
Deploying to a brand new Heroku application
Adding a Procfile
Adding a Ruby build pack
Resolving some outstanding security warnings from Github by running Bundle update locally and getting the new gemfile into my repo, prior to this there were no new Gem changes
None of these has changed the error I am getting.
If I clone the repo from github into a new folder on my Macbook I am able to get it up and running locally.
I have the following on my Macbook:
Ruby Version 2.6.5p114
Rails Version 6.0.3.2
Google does not seem to be turning up much, aside from some references to CPU architecture which I assume I have no control of in the Heroku environment.
My feeling is that it is related to bash being unable to execute bin/bundle but I've no idea why or how to resolve.
I vaguely recall having issues previously on this app, in that I was not able to run heroku run rake commands, possibly getting a similar error message, but to resolve I think I was able to simply run heroku run bin/rake
I believe the original rails new command was run on Windows 10 WSL environment in case that is relevant.
EDIT: I'm able to recreate a similar issue with rake, but the fix for rake does not work for bundle and I'm not even sure if it would help with the deployment issue.
➜ appbackend git:(master) heroku run rake
Running rake on ⬢ heroku-name-40049... up, run.8396 (Hobby)
bash: /app/bin/bundle: cannot execute binary file: Exec format error
➜ appbackend git:(master) heroku run bin/rake
Running bin/rake on ⬢ heroku-name-40049... up, run.5201 (Hobby)
Abort testing: Your Rails environment is running in production mode!
➜ appbackend git:(master)
➜ appbackend git:(master) heroku run bundle install
Running bundle install on ⬢ heroku-name-40049... up, run.7746 (Hobby)
bash: /app/bin/bundle: cannot execute binary file: Exec format error
➜ appbackend git:(master) heroku run bin/bundle install
Running bin/bundle install on ⬢ heroku-name-40049... up, run.4632 (Hobby)
bash: bin/bundle: cannot execute binary file: Exec format error
Turns out it was exactly as the error message stated Exec format error.
The bundle file in the bin directory was not the right format. Not sure how I managed to deploy in the first place (the history of this file has only 2 version in the repo, the first commit, and now the fix).
I was able to resolve by overwriting the bundle file from a different working rails install. Appreciated the help provided.
I am in process of installing Redmine app via RedmineInstall documentation I try step 5 :
bundle exec rake db:migrate
then error shows :
bundler: command not found: rake
Install missing gem executables with ´bundle install´
I use redmine 3.3.0 64 for windows
I use redmine gemfile and rake was installed (i see Using rake 11.2.2)
I tried reinstall it via bundle install or gem install/uninstall, but did not help (see Successfully installed rake-11.2.2 but rake do not work).
I tried this command from ruby/bin directory or redmine directory not success.
I do not understand, that rake is successfully installed, but when i try use it with bundle it says that command not found.
The problem may be in the directory where the Redmine or rake?
Try rake db:migrate in your redmine directory without bundle exec and see if that resolves your issue.
Bundler usually provides bin stubs for rake and other gem files, so that bundle exec is not necessary or will even fail because it will look in an other gem directory where, in this case, rake might not be installed.
I'm trying to pipe mail from postfix to a rails tasks. I've got this working successfully when just piping to a vanilla ruby script, but when switching to a rails task I get the following error in the mail.log from Postfix:
(Command died with status 1: "/usr/local/bin/rake". Command output: /usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in to_specs': Could not find rake (>= 0) amongst [] (Gem::LoadError) from /usr/lib/ruby/1.9.1/rubygems/dependency.rb:256:into_spec' from /usr/lib/ruby/1.9.1/rubygems.rb:1231:in gem' from /usr/local/bin/rake:22:in' )
Here is the piping line from master.cf
email-task unix - n n - 2 pipe
flags=Xhq user=appuser directory=/home/myapp/application/ argv=/usr/local/bin/rake RAILS_ENV=production myapp:process_email
Running the command which rake returns /usr/local/bin/rake so I have verified I have the correct rake path.
I've tried setting ENV['PATH'] inside of the .rake file to /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games and I've also tried cd'ing to the rails app directory in the pipe command but still causes the same error. I've done bundle install and update etc.
Any help is greatly appreciated...thank you!
UPDATE
I tried using bundle exec rake etc as suggested but am now getting this error:
Command died with status 127: "/usr/local/bin/bundle". Command output: bundler: command not found: rake Install missing gem executables with bundle install
I've tried adding gem 'rake' to the Gemfile as well. I'm assuming bundler can't find the Gemfile?
UPDATE (FIXED)
So the command that finally worked was the following:
email-task unix - n n - 2 pipe
flags=Xhq user=appuser directory=/home/myapp/application/ argv=/usr/local/bin/bundle exec /usr/local/bin/rake RAILS_ENV=production mytask
It was a combination of errors on my part.
Full paths need to be used for bundle and rake
app name is not needed in the task param for rake since the directory is being selected before executing
A side issue: an old version of ruby was being used which caused an unrelated gem error after executing the postfix pipe
Appreciate the help everyone.
I think your on the wrong track, it's not the system that can't find rake it's your rubygems. Instead of running rake as your command, try running bundle passing whatever you need to in order for it to basically be bundle exec rake...etc
Update
Based on your new information, it would seem that the rake gem is not installed in your app. Run bundle show rake
Assuming it's not there, I'm wondering why. Did you ship your app with packaged gems or something? Basically, did you not run bundle install in your deployed app?
Trying to run rake db:migrate I get:
$ rake db:migrate
(in /home/user/domains/staging)
log level debug
Missing these required gems:
haml ~> 3.1.4
htmlentities
fastercsv
You're running:
ruby 1.8.7.72 at /usr/bin/ruby1.8
rubygems 1.3.7 at /home/user/.gem/ruby/1.8, /usr/lib/ruby/gems/1.8
Run `rake gems:install` to install the missing gems.
rake aborted!
no such file to load -- json
I have two servers en both are updated via a git repository. On one server everything works fine, on the other I get the above error.
Whats up?
Have you tried bundle install or sudo bundle install in production? You might also try bundle exec rake db:migrate instead of just rake db:migrate. These are kind of guesses, but might help.
Is the path to the "ruby"/"rake" etc executables pointing at the correct one on the server that isn't working? It looks like you want to use REE, but your stack trace is 1.8, not REE.
You may need to export an environment variable to update your path to point at the correct Ruby binaries.
I am using Ruby Enterprise Edition for my project. When I check all my rake task by run the command rake -T , I got the following error message:
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. Using bundle exec may solve this.
The error message implies that I can use bundle exec to solve the problem, but I am not sure how? So, how to get rid of this error message?
------------------------------ more ---------------------------
I prefer to update my Gemfile instead of run bundle exec rake -T. But when I open my project Gemfile, I did not see rake 0.9.2 in my Gemfile, why the error message complains that I have it? Where could be the place I defined rake 0.9.2??
Run bundle exec rake -T, this ensures that the version of rake that is specified in your Gemfile is running, not another version.
Alternatively, update your Gemfile.
This is because your rake tool does not match the version written in the Gemfile.
You first need to run this command, to ensure rake 0.9.2 get installed:
bundle install
Then, you can run rake 0.9.2 with the following command:
bundle exec rake -T
The bundle thing is a nice tool to help you manage the dependency of your application. You can get more info from here.