After finishing the official getting started guide for RoR I played with it so much that I ruined the blog so I decided just to scrap everything and start again.
Now that I'm trying to run the rails server I get this error
/home/nadia/.gem/ruby/2.0.0/gems/bundler-1.5.2/lib/bundler/vendor/thor/actions.rb:109:in `expand_path': No such file or directory - getcwd (Errno::ENOENT)
from /home/nadia/.gem/ruby/2.0.0/gems/bundler-1.5.2/lib/bundler/vendor/thor/actions.rb:109:in `destination_root='
from /home/nadia/.gem/ruby/2.0.0/gems/bundler-1.5.2/lib/bundler/vendor/thor/actions.rb:85:in `initialize'
from /home/nadia/.gem/ruby/2.0.0/gems/bundler-1.5.2/lib/bundler/cli.rb:17:in `initialize'
from /home/nadia/.gem/ruby/2.0.0/gems/bundler-1.5.2/lib/bundler/vendor/thor.rb:359:in `new'
from /home/nadia/.gem/ruby/2.0.0/gems/bundler-1.5.2/lib/bundler/vendor/thor.rb:359:in `dispatch'
from /home/nadia/.gem/ruby/2.0.0/gems/bundler-1.5.2/lib/bundler/vendor/thor/base.rb:440:in `start'
from /home/nadia/.gem/ruby/2.0.0/gems/bundler-1.5.2/lib/bundler/cli.rb:10:in `start'
from /home/nadia/.gem/ruby/2.0.0/gems/bundler-1.5.2/bin/bundle:20:in `block in <top (required)>'
from /home/nadia/.gem/ruby/2.0.0/gems/bundler-1.5.2/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
from /home/nadia/.gem/ruby/2.0.0/gems/bundler-1.5.2/bin/bundle:20:in `<top (required)>'
from /home/nadia/.gem/ruby/2.0.0/bin/bundle:23:in `load'
from /home/nadia/.gem/ruby/2.0.0/bin/bundle:23:in `<main>'
in the gemfile I have added
gem 'railties', '~>4.0.2'
then
$ bundle install
to try and resolve the issue. However it still hasn't work. I'm fairly new so I'm not actually sure what the error is.
Any thoughts would be appreciated.
I'm also running rails v4.0.2 if that helps
This is a pretty weird thing to see:
No such file or directory - getcwd (Errno::ENOENT)
Are you trying to run this application from a directory you maybe moved, or even deleted? That error implies that it can't determine the current directory.
Define rails in gem file like this
gem 'rails', '4.0.2'
And then bundle install.
Whoops. I derped. All sorted now. I was simply trying to run it from the wrong directory.
Should have seen it earlier.
Related
I am trying to run the specs for a local clone of the activeadmin gems current master.
I am using ruby 2.2.2 and have bundled successfully.
When I try to run one of the specs like so:
bundle exec rspec spec/unit/filters/humanized_spec.rb
I am getting the following error:
The git source https://github.com/jruby/activerecord-jdbc-adapter is not yet checked out. Please run `bundle install` before trying to start your application
Coverage report generated for RSpec to /Users/aljoscha/gem/activeadmin/coverage. 0.0 / 0.0 LOC (100.0%) covered.
/Users/aljoscha/gem/activeadmin/spec/rails_helper.rb:13:in `require': cannot load such file -- active_record (LoadError)
from /Users/aljoscha/gem/activeadmin/spec/rails_helper.rb:13:in `<top (required)>'
from /Users/aljoscha/gem/activeadmin/spec/unit/filters/humanized_spec.rb:1:in `require'
from /Users/aljoscha/gem/activeadmin/spec/unit/filters/humanized_spec.rb:1:in `<top (required)>'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `load'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `block in load_spec_files'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `each'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `load_spec_files'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:100:in `setup'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:86:in `run'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/exe/rspec:4:in `<top (required)>'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/rspec:22:in `load'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/rspec:22:in `<main>'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'
which I cannot make sense of.
Especially since activerecord-jdbc-adapter is not even in the Gemfile.
What am I missing?
Try prepending your command with bundle exec:
bundle exec rspec spec/unit/filters/humanized_spec.rb
It looks like you have a local version discrepancy causing issues.
If not, did you follow all of the steps listed on their contributing readme?
If you are still stuck, you may be experiencing an issue with bundler itself. First, try updating bundler then reinstalling gems and attempt to run rspec. If that doesn't work you may need to delete the bundle cache folder and start over.
I'm going to re-answer to emphasize how to test a gem using appraisal as mentioned in CONTIBUTING:
bundle exec appraisal install
bundle exec appraisal rails_50 rspec spec/unit/filters/humanized_spec.rb
Thank you for your interest in Active Admin.
I'm honestly so lost. Every time I try to run any rails commands ie, rails g controller home, the command line throws me this error and I have no idea what's going on. I've uninstalled and reinstalled spring and I've also googled.
Someone help please?
Johnny#Johnnys-MacBook-Pro original_skillup (feature/s3_uploader) $ rails g controller spring
/Users/Johnny/.rvm/gems/ruby-2.2.1/gems/spring-1.3.6/lib/spring/application.rb:102:in `block in preload': undefined method `[]' for nil:NilClass (NoMethodError)
from /Users/Johnny/.rvm/gems/ruby-2.2.1/gems/spring-1.3.6/lib/spring/application.rb:102:in `map'
from /Users/Johnny/.rvm/gems/ruby-2.2.1/gems/spring-1.3.6/lib/spring/application.rb:102:in `rescue in preload'
from /Users/Johnny/.rvm/gems/ruby-2.2.1/gems/spring-1.3.6/lib/spring/application.rb:115:in `preload'
from /Users/Johnny/.rvm/gems/ruby-2.2.1/gems/spring-1.3.6/lib/spring/application.rb:143:in `serve'
from /Users/Johnny/.rvm/gems/ruby-2.2.1/gems/spring-1.3.6/lib/spring/application.rb:131:in `block in run'
from /Users/Johnny/.rvm/gems/ruby-2.2.1/gems/spring-1.3.6/lib/spring/application.rb:125:in `loop'
from /Users/Johnny/.rvm/gems/ruby-2.2.1/gems/spring-1.3.6/lib/spring/application.rb:125:in `run'
from /Users/Johnny/.rvm/gems/ruby-2.2.1/gems/spring-1.3.6/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/Johnny/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Johnny/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
Thanks!
I think you have Spring gem installed and the name of controller is conflicting.
https://github.com/rails/spring
Try changing the name of controller. Hopefully it works. Cheers!
To the previous answer, you can have a controller named home (there's no naming issues with that). It does look like you have an issue with the version of the spring gem you are using. Have you tried running 'bundle install'? I checked the spring gem on Github and it does not look like there are any current issues with the gem. You could remove the spring gem and see if the issue persists, if so, then you know the issue lies deeper.
That is Exception backrace issue in spring gem.
https://github.com/rails/spring/pull/459
update spring to 1.6.1
Recently came back to a computer (Mac OS X Lion 10.7) with which I've had repeated environment issues, started a new rails app, and ran
rake db:create
I got this error output (with --trace):
rake aborted!
dlopen(/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg_ext.bundle, 9): Library not loaded: /usr/lib/libpq.5.dylib
Referenced from: /Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg_ext.bundle
Reason: image not found - /Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg_ext.bundle
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg.rb:4:in `require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg.rb:4:in `<top (required)>'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
/Users/<username>/rails/<appname>/config/application.rb:7:in `<top (required)>'
/Users/<username>/rails/<appname>/Rakefile:4:in `require'
/Users/<username>/rails/<appname>/Rakefile:4:in `<top (required)>'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:637:in `raw_load_rakefile'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:94:in `block in load_rakefile'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
bin/rake:4:in `<main>'
config/application.rb:7 refers to:
Bundler.require(:default, Rails.env)
This comes on the heals of a couple environment issues that are, I'm sure, causing the issue, but I don't know how. Basically, I was having issues with homebrew (brew install wget wouldn't work, complaining it was already downloaded, but then saying:
checking for libssl... no
configure: error: --with-ssl=openssl was given, but SSL is not available
So I uninstalled homebrew, uninstalled my shell (fish shell), reinstalled both, and tried to start things from scratch. Probably not a great idea, in retrospect. I seem to have messed things up worse than they already were.
brew doctor seems to think most things are OK, though. The only thing that jumps out at me as possibly related is:
/Users/sasha/.rvm/bin/pkg-config
(There's another thing brought up -- "/usr/bin occurs before /usr/local/bin", but this only applies to the node, npm, and gcov-4.2 installs, which don't seem relevant to this Rails issue.)
And I think RVM is supposed to have its own pkg-config install, right?
At any rate, OpenSSL is installed and updated by homebrew, and looking good (it shows up in brew list). Also, my XCode Command Line Tools is up to date as well.
I guess my question is if anyone has any idea what's going on? I've tried reordering my path to comply with brew doctor, un/reinstalling lots of things, updating everything, etc, and this just won't go away. Super frustrating, cause I basically can't do anything without rake working. And I think this dylib and openssl issue might be interrelated, so I figured I'd just dump all this data here.
Any ideas? I'd really appreciate help.
Thanks!
EDIT -- This is using Rails 4.0, with the pg gem.
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0.rc1'
# Use postgresql as the database for Active Record
gem 'pg'
if that makes any difference.
UPDATE -- Seems to be related to this problem, which I'm also having. I think rake is not working because of pg, which isn't working because of crpyto/openssl.
The problem was based on an inexplicably empty libssl.dylib file. There was a backup (libssl.dylib.BAK), and I just overwrote the empty file with it and -- poof -- all the problems went away. No idea how that happened in the first place, but if anyone's having similar problems, I'd look for .BAK files in usr/lib/ and (if there are any) see if the associated files are empty.
I've just upgraded to ruby 1.9.3-p0 and rails 3.2.0. I'm now trying to debug an error in one of my tests using
rspec spec -d
But I get this error:
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:422:in `rescue in debug=': (RuntimeError)
**************************************************
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_threadptr_data_type - /home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so
If you have it installed as a ruby gem, then you need to either require
'rubygems' or configure the RUBYOPT environment variable with the value
'rubygems'.
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `require'
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `require'
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>'
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:408:in `require'
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:408:in `debug='
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration_options.rb:19:in `block in configure'
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration_options.rb:18:in `each'
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration_options.rb:18:in `configure'
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:21:in `run'
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
/home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
**************************************************
from /home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:407:in `debug='
from /home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration_options.rb:19:in `block in configure'
from /home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration_options.rb:18:in `each'
from /home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration_options.rb:18:in `configure'
from /home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:21:in `run'
from /home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
from /home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
from /home/map7/.rvm/gems/ruby-1.9.3-p0#rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
Install the new debugger gem that works with Ruby 1.9.3 and 1.9.2:
https://github.com/cldwalker/debugger
Stick this in your Gemfile:
# one-liner to install these properly: bash < <(curl -L https://raw.github.com/gist/1333785)
gem 'linecache19', '0.5.13'
gem 'ruby-debug-base19', '0.11.26'
You'll need to run that one-liner in order for bundler to pick up the proper gems.
EDIT: I forgot to link to the posts I used to get debugging working:
ruby-debug with Ruby 1.9.3?
ruby-debug19 on ruby-1.9.3-preview1
I guess I can't comment on other answers yet, but I found many of these instructions don't mention you'll still need to include the
gem 'ruby-debug19', :require => 'ruby-debug'
line in your Gemfile, in addition to the instructions siannopollo provides. Without this, I get a 'cannot load such file -- ruby-debug' error (OSX, rvm, 1.9.3-p125).
FWIW, the gist is hardcoded to 1.9.3-p0, so if you're on 1.9.3-p125, you might need to edit it (also, generally a bad idea to execute a gist you haven't read).
For me, all it took was:
gem 'debugger'
in the Gemfile
Had to upgrade the following
bundle update ruby-debug-base19
I created a fresh project using rails new Project -d=postgresql. If I then run rails server, I get the following error message:
C:/GemRepository/gems/actionpack-3.1.3/lib/action_dispatch.rb:34:in `require': cannot load such file -- active_model (LoadError)
from C:/GemRepository/gems/actionpack-3.1.3/lib/action_dispatch.rb:34:in `<top (required)>'
from C:/GemRepository/gems/railties-3.1.3/lib/rails/commands/server.rb:3:in `require'
from C:/GemRepository/gems/railties-3.1.3/lib/rails/commands/server.rb:3:in `<top (required)>'
from C:/GemRepository/gems/railties-3.1.3/lib/rails/commands.rb:48:in `require'
from C:/GemRepository/gems/railties-3.1.3/lib/rails/commands.rb:48:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I also tried
gem which active_model
which returned
C:/GemRepository/gems/activemodel-3.1.1/lib/active_model.rb
Please help me.
Had this problem, came across this post. This fixed it for me:
rvm gemset pristine
Well, I managed to solve it.
I restarted my computer, deleted everything from my gem repository, reinstalled rubygems (ruby setup.rb) and reinstalled rails (gem install rails).
Thanks anyway :)
What version of rails is in the gem file? And have you run 'bundle install'?
I notice that Actionpack is 3.1.3 is called by the server, but the activemodel found is 3.1.1.
Run the bundle command from the project directory
I had a similar error and it was due to accidentally corrupting my Gemfile, so it is worth checking that. If it is version controlled then just git checkout Gemfile and bundle update to rebuild.
gem uninstall active-model and perfomr gem install active-model