ruby-on-railsrubylinuxubuntu

/usr/bin/env: ‘ruby3.0’: No such file or directory


I try to run this command sudo bundle exec rake ridge:apply ALLOW_DROP_TABLE=1 ALLOW_REMOVE_COLUMN=1

but get this following error /usr/bin/env: ‘ruby3.0’: No such file or directory

after that I use which ruby to see the location which is in /home/hai/.rbenv/shims/ruby

Then I created a soft link sudo ln -sv /home/hai/.rbenv/shims/ruby /usr/bin/ruby

but still get the same error.

ruby -v gives me ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]


Solution

  • I had the exact same output while running any bundle command, and this is how I got it working again.

    Edit your bundler script. Mine was at /usr/local/bin/bundle. Change #!/usr/bin/env ruby3.0 to #!/usr/bin/env ruby. For me this got bundler working temporarily.

    Run sudo bundle update --bundler in your project directory. This will update bundler and I believe regenerate the bundler script.

    Bundler is good as new.