Thursday, May 5, 2022

[SOLVED] Rails command line cannot do rails c anymore, only bundle exec rails console

Issue

I was being denied permission in my bin/rake and bin/rails so I executed chmod +x bin/rake and bin/rails. However when I do rails console or rails server I get

env: ruby.exe: No such file or directory 

the only work around is bundle exec rails console or bundle exec rails server. I was wondering why because in my other Rails projects and when I create new ones rails s/c still works.


Solution

I think your bin directory is corrupted, you need to regenerate it. Please try the following command:

rm -r bin/*
bundle exec rake rails:update:bin


Answered By - Ashish Jambhulkar
Answer Checked By - Clifford M. (WPSolving Volunteer)