Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot start rails server using bash -c #5639

Closed
babajidemm opened this issue Jul 23, 2020 · 1 comment
Closed

Cannot start rails server using bash -c #5639

babajidemm opened this issue Jul 23, 2020 · 1 comment
Labels

Comments

@babajidemm
Copy link

Environment

Windows build number: Microsoft Windows [Version 10.0.18363.778]
Your Distribution version: Ubuntu Release: 20.04
Whether the issue is on WSL 2 and/or WSL 1: Linux version 4.4.0-18362-Microsoft ([email protected]) (gcc version 5.4.0 (GCC) ) #476-Microsoft Fri Nov 01 16:53:00 PST 2019

Steps to reproduce

I have got a Rails project which I normally run inside the WSL. I would like to do the same thing from outside the WSL using bash -c (or wsl (?)). I ran this from both CMD and Powershell

bash -c "cd /mnt/c/<path/to/project>;bin/rails s

And I got this error.

/usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
        from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /mnt/c/<path/to/project>/config/boot.rb:5:in `<top (required)>'
        from bin/rails:3:in `require_relative'
        from bin/rails:3:in `<main>'

I also tried using bundler with
bash -c "cd /mnt/c/<path/to/project>;bundle exec bin/rails s"

I got

/bin/bash: bundle: command not found

Could you please help out here?

@therealkenc
Copy link
Collaborator

therealkenc commented Jul 23, 2020

That is not a repro, but you can try (ref #5232):

C:\> wsl.exe /bin/bash -c 'cd /mnt/c/<path/to/project>; bundle exec bin/rails s'

If that doesn't work, have a look at the output of:

C:\> wsl.exe /bin/bash -c 'whereis bundle'

If that doesn't return /usr/bin/bundle as the first hit, then you are probably missing a sudo apt install ruby-bundler (and possibly else).

Also it is highly recommended to operate in /home not /mnt/c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants