'C:/Ruby30-x64/bin/ruby.exe: bad interpreter: No such file or directory

I'm new to rails.

Error -bash: /mnt/c/Ruby30-x64/bin/rails: C:/Ruby30-x64/bin/ruby.exe: bad interpreter: No such file or directory

I'm trying to run server on my machine but it is showing this error. I have been working on this for quite sometime, everything was working fine. Just switched to another project and then came back here, this error showed up. Please help.

Working on WSL in windows 10.



Solution 1:[1]

It was a ruby version error. The ruby version wasn't set.

This helped me resolve the issue rvm use {ruby_version}@{project}

eg: rvm use 2.6.6@eloecommerce

Solution 2:[2]

Add the path and alias to ~/.bashrc

export RUBYBIN=/{{YOUR_PATH}}/Ruby30-x64/bin
alias ruby="$RUBYBIN"/ruby
alias ruby.exe=$RUBYBIN/ruby.exe
alias gem="$RUBYBIN"/gem.cmd
alias bundle="$RUBYBIN"/bundle.bat
alias bundler="$RUBYBIN/bundler.bat"
alias jekyll="$RUBYBIN/jekyll.bat"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Burhan Gardezi
Solution 2 user_ring