heroku run -a app script/rails console
gives:
Running `script/rails console` attached to terminal... up, run.3422
bash: script/rails: Permission denied
am on Windows 8 ...
heroku version
heroku/toolbelt/2.41.0 (i386-mingw32) ruby/1.9.3
needed to add "ruby" after app and before command ...
heroku run -a my-app ruby script/rails console
Running `ruby script/rails console` attached to terminal... up, run.5473
... various deprecation warnings re "You have Rails 2.3-style plugins in vendor/plugins!
Loading production environment (Rails 3.2.11)
irb(main):001:0>
(clue was provided from here )
Related
I want to check the version of my production database from a shell method running on my local MacOS development machine. From the command line, I can successfully run
heroku run rake db:version --remote production
but if I open a rails console session and type in
hv = `heroku run rake db:version --remote production`
I see the following error message:
/Users/Chris/.rvm/gems/ruby-2.5.1#golf_mentor_5.0.7/gems/bundler-1.16.1/lib/bundler/definition.rb:489:in `validate_ruby!': Your Ruby version is 1.9.3, but your Gemfile specified 2.5.1 (Bundler::RubyVersionMismatch)
from /Users/Chris/.rvm/gems/ruby-2.5.1#golf_mentor_5.0.7/gems/bundler-1.16.1/lib/bundler/definition.rb:464:in `validate_runtime!'
from /Users/Chris/.rvm/gems/ruby-2.5.1#golf_mentor_5.0.7/gems/bundler-1.16.1/lib/bundler.rb:101:in `setup'
from /Users/Chris/.rvm/gems/ruby-2.5.1#golf_mentor_5.0.7/gems/bundler-1.16.1/lib/bundler/setup.rb:20:in `<top (required)>'
from /usr/local/heroku/ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/heroku/ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require
I am using ruby 2.5.1. The heroku --version command yields heroku-cli/6.16.13-dbb9c23 (darwin-x64) node-v9.11.1. How do I fix this?
It turns out this is related to this github https://github.com/bundler/bundler/issues/2489. It looks like bundler is confused by a shebang in the heroku cli file. The solution is to use a clean environment for bundler
Bundler.with_clean_env {`heroku run rake db:version --remote production`}
Im trying to reach the production env console. I think rbenv is messing with me.
When i run rails console production i get the old:
Usage:
rails new APP_PATH [options]
So i figure, it doesn't recognize my dir as an rails app because of the versions so I run. So the rails -v tells me:
deploy#webb-labb2:~/prognoser/current$ rails -v
Rails 5.1.0
Which is the wrong version of the app.
And the bundle exec rails -v command gives me:
deploy#webb-labb2:~/prognoser/current$ bundle exec rails -v
Rails 4.2.8
Which is the correct version. But the:
deploy#webb-labb2:~/prognoser/current$ bundle exec rails console production
Still gives me the old:
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH]
I ran
$ bundle exec rake rails:update:bin
that did the trick. And I had to add a boot file to the shared/config directory.
I'm brand new to Rails and I'm following this tutorial. I successfully pushed my app to heroku, but I can't get the database migrate.
I use a virtual machine with ubuntu server .
I typed:
$ heroku run rake db:migrate
and got this error:
Running `rake db:migrate` attached to terminal... up, run.3356
/usr/bin/env: ruby2.2: No such file or directory
I don't understand what I can do. I tried to use
$ heroku run rails db:migrate
$ rake rails:update:bin
but it didn't help.
the solution that worked for me is that for every file in the bin directory of my project, i changed the first line from:
#!/usr/bin/env ruby2.2
to
#!/usr/bin/env ruby
I'm following Michael Hartl's tutorial on learning web development with rails. When it comes to migrating the database the command:
heroku run rake db:migrate
gives the following error
Running `rake db:migrate` attached to terminal... up, run.2675
/usr/bin/env: ruby1.9.1: No such file or directory
I'm using Ruby 1.9.3 and I have declared that in the Gemfile. I don't really understand what could be causing this error and any help at all would be greatly appreciated.
use this
/usr/bin/env ruby
instead of
/usr/bin/env ruby.exe
on following files of your app.
bin/bundle
bin/rails
bin/rake
and the exec
heroku run rake db:migrate
To solve my problem, which is discussed in "will_paginate error in production undefined method 'paginate'", I tried running:
script/rails runner -e production
and:
bundle exec script/rails runner -e production
on the server like suggested in this github issue: https://github.com/mislav/will_paginate/issues/308#issuecomment-17167158
But I get the following error:
bundler: command not found: script/rails
Install missing gem executables with `bundle install`
Bundle install doesn't help. Any suggestions?
I'm using: Ruby 2.0.0p247, Rails 4.0.0, Ubuntu 12.10 LTS, Unicorn, Capistrano
Try this instead:
bundle exec rails runner -e production.
Use bin/rails runner for rails4 (when the bin/rails file exists)