Weird rails error “permission denied: bin/rails” for old rails apps

后端 未结 6 1452
执笔经年
执笔经年 2020-12-29 08:42

I\'m getting this error whenever I run rails (or any rails command) _rails_command:2: permission denied: bin/rails ONLY when i\'m inside some

相关标签:
6条回答
  • 2020-12-29 08:59

    So what worked for me, anyone coming across this issue is to run

    bundle exec rake app:update:bin
    

    You'll be given a prompt asking if you want to overwrite? The options here are:

    • Y - yes (default one, just press Enter for it)
    • n - no (leave current file without changes)
    • a - all (apply all changes)
    • q - quit
    • d - diff
    • h - help

    I chose a and it seemed to work ok.

    0 讨论(0)
  • 2020-12-29 09:09

    The solution for me was:

    bundle exec rake rails:update:bin
    

    or just use:

    For new rails versions:

     bundle exec rake app:update:bin
    

    For old rails versions:

    bundle exec rake rails:update:bin
    
    0 讨论(0)
  • I have this when I try to use a rails 4.0 version. So when I try to put bundle exec first, like:

    bundle exec rake db:migrate
    

    or

    bundle exec rails s
    

    work's.

    0 讨论(0)
  • 2020-12-29 09:17

    Run

    bundle exec rake rails:update:bin
    

    It will update bin/rails and bin/rake files.

    0 讨论(0)
  • 2020-12-29 09:18

    In the directory you mentioned is your rails in executable mode. If not you can apply

    chmod u+x bin/rails
    

    and make it executable.

    0 讨论(0)
  • 2020-12-29 09:26

    I had the same issue and here's what helped me. Open ~/.zshrc and add this

    export PATH="$HOME/.rbenv/bin:$PATH"
    eval "$(rbenv init -)"
    
    0 讨论(0)
提交回复
热议问题