# "No such file or directory -- bin/rails (LoadError)" - when initializing Sorcery for my app

**URL:** <https://www.ruby-forum.com/t/no-such-file-or-directory-bin-rails-loaderror-when-initializing-sorcery-for-my-app/240851>\
**Category:** Rails\
**Created:** [May 2, 2014, 9:34pm UTC](https://www.ruby-forum.com/t/no-such-file-or-directory-bin-rails-loaderror-when-initializing-sorcery-for-my-app/240851 "2014-05-02T21:34:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [May 2, 2014, 9:34pm UTC](https://www.ruby-forum.com/t/no-such-file-or-directory-bin-rails-loaderror-when-initializing-sorcery-for-my-app/240851/1 "2014-05-02T21:34:55Z")

</div>

Hi,

I am trying to run rails generate sorcery:install, but run into a  
problem  
that seems to be in my Ruby/Rails environment.  
I’ve tried to Google this now for some time with no results.  
Would appreciate if someone could give me some hints on what to look  
for,  
or guidance to get it sorted.  
I’ve tried to uninstall my rubies, and install them again through Rvm.  
Still getting the same results:

OlimobileRetina:responsive\_fw oleingemann$ rails generate  
sorcery:install

```
  create config/initializers/sorcery.rb

generate model User --skip-migration

```

/Users/oleingemann/.rvm/rubies/ruby-2.0.0-p353/bin/ruby: No such file or  
directory – bin/rails (LoadError)

```
  insert app/models/user.rb

```

/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/actions/inject\_into\_file.rb:98:in  
`binread’: No such file or directory -  
/Users/oleingemann/rails\_projects/responsive\_fw/app/models/user.rb  
(Errno::ENOENT)

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/actions/inject\_into\_file.rb:98:in  
`replace!’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/actions/inject\_into\_file.rb:59:in  
`invoke!’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/actions.rb:94:in  
`action’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/actions/inject\_into\_file.rb:30:in  
`insert\_into\_file’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/actions/file\_manipulation.rb:204:in  
`inject\_into\_class’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/sorcery-0.8.5/lib/generators/sorcery/install\_generator.rb:50:in  
`inject\_sorcery\_to\_model’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/sorcery-0.8.5/lib/generators/sorcery/install\_generator.rb:43:in  
`configure\_model’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/command.rb:27:in  
`run’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/invocation.rb:126:in  
`invoke\_command’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/invocation.rb:133:in  
`block in invoke\_all’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/invocation.rb:133:in  
`each’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/invocation.rb:133:in  
`map’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/invocation.rb:133:in  
`invoke\_all’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/group.rb:232:in  
`dispatch’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/base.rb:440:in  
`start’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/generators.rb:157:in  
`invoke’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands/generate.rb:11:in  
`\<top (required)\>’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.1.0/lib/active\_support/dependencies.rb:247:in  
`require’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.1.0/lib/active\_support/dependencies.rb:247:in  
`block in require’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.1.0/lib/active\_support/dependencies.rb:232:in  
`load\_dependency’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.1.0/lib/active\_support/dependencies.rb:247:in  
`require’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands/commands\_tasks.rb:135:in  
`generate\_or\_destroy’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands/commands\_tasks.rb:51:in  
`generate’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands/commands\_tasks.rb:40:in  
`run\_command!’

from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands.rb:17:in  
`\<top (required)\>’

from script/rails:6:in `require’

from script/rails:6:in `’

thanks a lot guys for looking at it. /ole in norway

---

<div class="post-metadata">

**Author:** ![Ole\_Ingemann\_KjSSrm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/8baadc/32.png) [@Ole\_Ingemann\_KjSSrm](https://www.ruby-forum.com/u/Ole_Ingemann_KjSSrm)\
**Post date:** [May 2, 2014, 9:38pm UTC](https://www.ruby-forum.com/t/no-such-file-or-directory-bin-rails-loaderror-when-initializing-sorcery-for-my-app/240851/2 "2014-05-02T21:38:00Z")

</div>

without the formatting:

OlimobileRetina:responsive\_fw oleingemann$ rails generate  
sorcery:install  
create config/initializers/sorcery.rb  
generate model User --skip-migration  
/Users/oleingemann/.rvm/rubies/ruby-2.0.0-p353/bin/ruby: No such file or  
directory – bin/rails (LoadError)  
insert app/models/user.rb  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/actions/inject\_into\_file.rb:98:in  
`binread': No such file or directory - /Users/oleingemann/rails_projects/responsive_fw/app/models/user.rb (Errno::ENOENT) from /Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:98:in`replace!’  
from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/actions/inject\_into\_file.rb:59:in  
`invoke!' from /Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/actions.rb:94:in`action’  
from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/actions/inject\_into\_file.rb:30:in  
`insert_into_file' from /Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/actions/file_manipulation.rb:204:in`inject\_into\_class’  
from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/sorcery-0.8.5/lib/generators/sorcery/install\_generator.rb:50:in  
`inject_sorcery_to_model' from /Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/sorcery-0.8.5/lib/generators/sorcery/install_generator.rb:43:in`configure\_model’  
from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/command.rb:27:in  
`run' from /Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/invocation.rb:126:in`invoke\_command’  
from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/invocation.rb:133:in  
`block in invoke_all' from /Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/invocation.rb:133:in`each’  
from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/invocation.rb:133:in  
`map' from /Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/invocation.rb:133:in`invoke\_all’  
from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/group.rb:232:in  
`dispatch' from /Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/thor-0.19.1/lib/thor/base.rb:440:in`start’  
from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/generators.rb:157:in  
`invoke' from /Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands/generate.rb:11:in`\<top (required)\>’  
from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.1.0/lib/active\_support/dependencies.rb:247:in  
`require' from /Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in`block in require’  
from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.1.0/lib/active\_support/dependencies.rb:232:in  
`load_dependency' from /Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in`require’  
from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands/commands\_tasks.rb:135:in  
`generate_or_destroy' from /Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:51:in`generate’  
from  
/Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands/commands\_tasks.rb:40:in  
`run_command!' from /Users/oleingemann/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands.rb:17:in`\<top (required)\>’  
from script/rails:6:in `require' from script/rails:6:in`’

---

<div class="post-metadata">

**Author:** ![Ole\_Ingemann\_KjSSrm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/8baadc/32.png) [@Ole\_Ingemann\_KjSSrm](https://www.ruby-forum.com/u/Ole_Ingemann_KjSSrm)\
**Post date:** [May 3, 2014, 4:26am UTC](https://www.ruby-forum.com/t/no-such-file-or-directory-bin-rails-loaderror-when-initializing-sorcery-for-my-app/240851/3 "2014-05-03T04:26:02Z")

</div>

On Fri, May 2, 2014 at 2:36 PM, Ole Ingemann Kjørmo  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> /Users/oleingemann/rails\_projects/responsive\_fw/app/models/user.rb  
> (Errno::ENOENT)

Can you see if there is, in fact, a bin/rails script in your app  
directory? Something seems quite off there. I have no idea what  
sorcery is or does, but not finding bin/rails seems like a huge  
problem regardless.

---

<div class="post-metadata">

**Author:** ![Ole\_Ingemann\_KjSSrm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/8baadc/32.png) [@Ole\_Ingemann\_KjSSrm](https://www.ruby-forum.com/u/Ole_Ingemann_KjSSrm)\
**Post date:** [May 3, 2014, 11:21am UTC](https://www.ruby-forum.com/t/no-such-file-or-directory-bin-rails-loaderror-when-initializing-sorcery-for-my-app/240851/4 "2014-05-03T11:21:13Z")

</div>

Fixed it!

Since this was an app upgraded from Rails 3.x.x to Rails 4.xxx, a folder  
within my app  
was still called script and not bin (as this is a common rails 4 thing?)

Renamed the folder and the command with sorcery runs fine.

---

<div class="post-metadata">

**Author:** ![Ole\_Ingemann\_KjSSrm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/8baadc/32.png) [@Ole\_Ingemann\_KjSSrm](https://www.ruby-forum.com/u/Ole_Ingemann_KjSSrm)\
**Post date:** [May 3, 2014, 10:56am UTC](https://www.ruby-forum.com/t/no-such-file-or-directory-bin-rails-loaderror-when-initializing-sorcery-for-my-app/240851/5 "2014-05-03T10:56:03Z")

</div>

Thanks for having a look tamouse.  
Sorcery is a light weight authentication gem, that is a bit easier than  
e.g. Devise.  
We use it for another app we are running in production and it works  
great!  
Check it out:)

On my problem:  
I have a file (or folder) at  
/Users/oleingemann/.rvm/rubies/ruby-2.0.0-p353/bin/ruby , but not a  
bin/rails in my app.

This might be a problem that sorcery is not supported by Rails 4.1 ?  
It’s a bit funny that it’s failing because all my other gems, rails,  
rubies  
are working fine.  
Maybe a Sorcery expert could tell us what’s going on.  
Have a nice weekend 🙂
