I am attempting to install a Diaspora pod on my Dreamhost account, following the instructions here:
https://github.com/diaspora/diaspora/wiki/Installing-and-Running-Diaspora
Everything went smooth until it was time to use Rake in order to set up the database. I created the databases using dreamhost's web interface, and then attempted the line given in the guide:
RAILS_ENV=production bundle exec rake db:migrate
The result being:
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake: Is a directory - /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake (Errno::EISDIR)
from /usr/bin/rake:19:in `load'
from /usr/bin/rake:19
It looks like some sort of Rake problem (and indeed, /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake is a directory).
I have some other homemade Ruby-on-Rails projects running on Dreamhost and have no similar problem with rake for them. Their rakefile looks a little different but I'm not sure what causes the problem.
Just a guess, would it help to set RAILS_ENV=production on the end of the line?
Related
I'm following Ruby on Rails Tutorial (Rails 5) Learn Web Development with Rails
Michael Hartl, using rails 5.0.0.1, when I tried to run the following command in bash
rails generate scaffold User name:string email:string
I received this error
Version: 1.7.2
Usage: spring COMMAND [ARGS]
Commands for spring itself:
binstub Generate spring based binstubs. Use --all to generate a binstub for all known commands. Use --remove to revert.
help Print available commands.
server Explicitly start a Spring server in the foreground
status Show current status.
stop Stop all spring processes for this project.
Commands for your application:
rails Run a rails command. The following sub commands will use spring: console, runner, generate, destroy, test.
rake Runs the rake command
rails aborted!
Don't know how to build task 'rails' (see --tasks)
/home/Medo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/rake_proxy.rb:13:in `block in run_rake_task'
/home/Medo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/rake_proxy.rb:10:in `run_rake_task'
/home/Medo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/home/Medo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:9:in `require'
bin/rails:9:in `<main>'
(See full trace by running task with --trace)
I don't know what causing this issue and can't see a solution for it after hour of searching.
Well this what worked for me
bundle install --binstubs
after it, rails worked without a problem
This is what help give us. I just run this 3 commands and it's work.
Looks like your app's ./bin/rails is a stub that was generated by
Bundler.
In Rails 5, your app's bin/ directory contains executables that are
versioned like any other source code, rather than stubs that are
generated on demand.
Here's how to upgrade:
bundle config --delete bin # Turn off Bundler's stub generator
rails app:update:bin # Use the new Rails 5 executables
git add bin # Add bin/ to source control
You may need to remove bin/ from your .gitignore as well.
I am not sure but maybe it can help
$ spring stop
$ rails generate scaffold User name:string email:string
Can you check if rails s is working.Also try
bin/rails generate scaffold User name:string email:string
After installing a new gem, Slackistrano to already succesfully deployed app with Capistrano, our deployments started failing with the following error during rake assets:precompile or rake db:migrate tasks
cap aborted!
SSHKit::Command::Failed: rake stdout: Nothing written
rake stderr: Nothing written
/Users/pete/.rvm/gems/ruby-2.2.2/gems/sshkit-1.3.0/lib/sshkit/command.rb:94:in `exit_status='
This error is obviously not very helpful.
If I ran the capistrano task cap staging assets:precompile, it would succeed.
So what's going on here?
There are a few other solutions to SSHKit failures during cap deployments, but most of them were for first time deployments and didn't work for me.
Here's how I figured out the solution(after much hair pulling).
I knew that it was probably the new gem that was causing the problem. So I went into the source code for sshkit/command.rb and outputted the command it was trying to execute on the remote server.
I then logged into the remote server and ran it manually and got the following output:
$ cd /home/web/sites/site.com/releases/20160106224143 && ( RAILS_ENV=production ~/.rvm/bin/rvm default do bundle exec rake db:migrate )
rake aborted!
NoMethodError: undefined method `each_pair' for "slack:deploy:updating":String
/home/web/sites/site.com/shared/bundle/ruby/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1602:in `compile!'
/home/web/sites/site.com/shared/bundle/ruby/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1344:in `add_filter'
/home/web/sites/site.com/shared/bundle/ruby/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1331:in `before'
/home/web/sites/site.com/shared/bundle/ruby/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1989:in `block (2 levels) in delegate'
/home/web/sites/site.com/shared/bundle/ruby/2.2.0/gems/slackistrano-1.0.0/lib/slackistrano/tasks/slack.rake:121:in `<top (required)>'
So, the problem started with Slackistrano, but then, what? why is Sinatra there? I don't use Sinatra in my app.
Well, I discovered that there was a gem in my Gemfile that was for development only(mailcatcher) but was in the production section of the Gemfile. I removed this and redeployed successfully.
However, there is obviously a deeper issue because there seems to be some sort of name collision on the "before" method of sinatra and capistrano that caused this in the first place.
I'm posting here to help others debug possible SSHKit errors during Cap deployments and also perhaps to guide others on weird name collisions between Sinatra and Capistrano.
For me this issue can arise if you're accidentally on an incompatible version of Ruby whilst running Capistrano. I had to add a .ruby-version to clamp it for me to 2.7.5 whilst using gem 'capistrano', '3.11.0'.
So I'm not sure if stating Ruby version 2 or higher is strictly true.
I am experiencing an error with running the Rake command. When I try to Rake in my Rails project, I get an error that says Could not find rake-10.1.1 in any of the sources.
I put Rake 10.1.1 in my Gemfile, but it appears to do nothing when I bundle install.
I've tried uninstalling then installing the Rake gem in my computer's Ruby, RVM Ruby-2.1.0, the RVM Ruby-2.1.0#global, and the RVM gemset that I created for the specific project. I've also tried removing the Gemfile.lock and then bundle installing.
I've tried to manually run rake out of the terminal in multiple different Ruby/gems files including RVM. It gives this error:
/Users/me/.rvm/gems/ruby-2.1.0/gems/rake-10.1.1/bin/rake ; exit;
~ me$ /Users/me/.rvm/gems/ruby-2.1.0/gems/rake-10.1.1/bin/rake ; exit;
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
I have a Rakefile in my project and have tried renaming it as well (Rakefile.rb, rakefile).
When I run Rake commands such as rake db:migrate, I get this error:
rake aborted!
undefined local variable or method config' for main:Object
/Users/me/RailsProject/config/environment.rb:4:in'
/Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in require'
/Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:inblock in require'
/Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in load_dependency'
/Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:inrequire'
/Users/me/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:189:in require_environment!'
/Users/me/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:250:inblock in run_tasks_blocks'
/Users/me/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in eval'
/Users/me/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
I've looked everywhere for the solution before coming here, but I could not find it. I would be appreciative if someone could give me some advice on this issue. Thank you in advance.
Looks like it it having trouble finding dependencies. Have you installed rake on your system with gem install rake? If not you will need to use bundle exec rake.
I don't know what the problem was, but I solved it by creating a new gemset, installing Rake to it, and using it. I also switched from Rubymine to Sublime. It may have been Rubymine trying to use a different gemset. Beware of those IDE settings.
guys! I am a newbie for Ruby on Rails and refinerycms.
Currently, I am study the refinerycms. I want to find all the missing key so as to translate refinerycms. According to the tutorial, I should run the command
bundle exec rake refinery:testing:dummy_app
so as to enable additional useful rake tasks. But when I run this command, it says
rake aborted!
Don't know how to build task 'refinery_testing:dummy_app'
Does any one know the reason?
BTW, I have already added the gem "refinerycms-testing" to Gemfile and installed it already, and I also in the root directory of the project.
I think your problem is that you are not in the good directory.
cd vendor/extension/your_extension_name
bundle exec rake refinery:testing:dummy_app
Hope it helps,
-frbl
since several days I have this problem:
For a few days it has worked and now I can't do it works again. I setup a rails server on ubuntu with apache-2. I used a git repository to get all new change. After I run
sudo rake db:migrate RAILS_ENV=production
But after have restart apache server I can see that rails use the development db and not the production while before it has used it.
I don't really understand what can cause this. So i really appreciate some help.
Thanks in advance.
Try:
env RAILS_ENV=production rake db:migrate
You can also add the following line to your $HOME/.bash_profile:
export RAILS_ENV=production
I found my problem. In apache sites configuration I had RailsEnv development instead of production.
But now I have another problem: rails does not start due to
* Exception ArgumentError in
PhusionPassenger::Railz::ApplicationSpawner (No association found for
name machines'. Has it been defined yet?) (process 16052):
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:245:in
accepts_nested_attributes_for'
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:222:in
each'
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:222:in
accepts_nested_attributes_for'
from /home/et1/wip3/sophia/app/models/machines_operatingsystem.rb:2
But I don't understand why.