Ask A Question

Notifications

You’re not receiving notifications from this thread.

Setup Windows 10 Discussion

Chris Oliver asked in General
james chalmers james chalmers

I installed ruby and rails correctly, but when I run my new rails app, my browser cannot connect. I must have missed something obvious somewhere. Has anyone else had this problem?

Reply
Gustavo Border Gustavo Border

Nothing wrong! Just had to start the MySQL service: "sudo service mysql start"

Reply

Is there anything wrong with just running `sudo apt install rbenv` instead of the shell script? I was having issues with the script. Only the plugins folder was cloned...

Reply

Doesn't work with me.
rails aborted!
Don't know how to build task 'v' (see --tasks)
/home/Emad/myapp/bin/rails:9:in `require'
/home/Emad/myapp/bin/rails:9:in `<top (required)="">'
/home/Emad/myapp/bin/spring:15:in `<top (required)="">'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
(See full trace by running task with --trace)

Reply

Just wanted to let you know that I just got this up and running! Thankfully I didn't have any issues. Thank you to whoever for putting this together! Great job!!!!

Reply
Thanks for tutorial, although I think you should take a moment to say if you have Windows Git you don't really need git install and likewise if you have mySQL already running as a service you don't need that either, just point database.yaml to windows instance.
Reply
Bagus, it should be called "software-properties-common" now or "python3-software-properties". Making an update for that.
Reply

Alberto, yep. You'll always need libpq-dev to compile the C extension for Ruby to talk to Postgres. 👍

Reply

Hey John, not sure why that command doesn't work from you. I just pasted in the RVM installation instructions from their website. I don't use RVM though but as long as you get the gpg keys imported, that's all you need.

Reply

Hi,

I just impressed, awesome tutorial.

I love this tutorial.

Thanks

Reply

Hey all,
So I got this running a long time ago and haven't had any issues since but now when I run any rails command I get a warning that says:
/home/user/.rbenv/versions 2.5.3/lib/ruby/gems/2.5.0/gems/railities-5.2.2/lib/rails/app_loader.rb:53 warning: Insecurable world writeable dir mnt/c/rails/project

All the stackoverflow answers are to chmod go-w /home/user but this and many derivations of this doesn't work. What else can I try?

Reply

@eliot I looked into this a few months ago and just accepted that it wasn't going to go away unless WSL was changed by Microsoft. Details at: https://github.com/Microsoft/WSL/issues/1426.

There appears to be ways to get rid of it but could introduce a security issue... I decided it was probably a bit of OCD on my behalf and to just let it go. I just find chasing these bugs means hours lost where I could actually be writing code. If you do figure out a good way please tell though.

Reply

Hi Jay!
Agreed, one can spend many hours trying to figure out the root cause of why certain things happen. In the end I found a "solution". Within the /mnt/c/ folder I rm -rf the original rails folder and then ran, "mkdir rails_sites, rails new....etc" and by deleting the old dir and creating a new one seems to have worked for the time being. It is strange this is the first time I have had any issues with the linux subsystem. Besides this minor hiccup I have really enjoyed it. I will update if I find anything else.

Reply

Hi, im using Windows 10 with the WSL, and im trying to set the Ruby Interpreter in RubyMine to the one i install using Chirs guide, using the following route /home/tensai/.rbenv/shims/ruby, the problem is that when it starts to Loading the Enviorment throws a Communication Error?

Can anyone tell how i can properly set my RubyMine to use the ruby install in WSL? using rbenv as the version manager.

Reply

I don't use RubyMine, but according to this, you might need to point to the ruby version inside the .rbenv folder instead of the shim. That way rubymine can find the gems directory correctly.

You can read the post here: https://df.tips/t/topic/326/3

Reply

Hey having a hard time debugging an error maybe someone has some insight?

gem install bundler
Fetching bundler-2.0.1.gem
/home/dj/.rbenv/rbenv.d/exec/gem-rehash/rubygems_plugin.rb:6: warning: Insecure world writable dir /home/dj/.rbenv/versions in PATH, mode 040777
Successfully installed bundler-2.0.1
Parsing documentation for bundler-2.0.1
Installing ri documentation for bundler-2.0.1
Done installing documentation for bundler after 10 seconds
1 gem installed

this insecure world writeable dir has been plaguing me if I try to set up a DB and run rake db:create or rails db:create it wont allow it to do anything any help is appriciated!

Reply

Hey Chris I'm getting the following error:
PG::ConnectionBad (could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
):

Reply

Hey Arnas,

Your Postgres server isn't running. I think most people have the best results installing Postgres on Windows and running it there, then having Rails from WSL connect to that.

Reply

how connect with wsl?

Reply

Try to export PGHOST=localhost to the bottom of your ~/.bashrc file in WSL

Reply

Hi, can anyone help me with a problem, I'm using windows 10 I have installed ruby, Ubuntu and WSL. Whenever I run my code in visual studio editor or console, I receive this warning message,
warning: Insecure world writable dir /mnt/c in PATH, mode 040777
Is there any way I can fix the problem?

Reply

i have the same problem:
i tried an older version of bundler still no change.
then i've seen this :
gem install bundler -v 2.0.1
Fetching: bundler-2.0.1.gem (100%)
/home/cod/.rbenv/rbenv.d/exec/gem-rehash/rubygems_plugin.rb:6: warning: Insecure world writable dir /home/cod/.rbenv/versions/2.5.7 in PATH, mode 040777
Successfully installed bundler-2.0.1
Parsing documentation for bundler-2.0.1
Installing ri documentation for bundler-2.0.1
Done installing documentation for bundler after 5 seconds
1 gem installed

so i think that your solution chmod +t -R ~/.bundle is not good in my case,
error
chmod: cannot access '/home/cod/.bundle': No such file or directory

any idea for an work around?
thank you

Reply

this solved my issue:
add this to the win 10 path variable:
C:\Users\”Your user” \AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\mnt

Reply

Hi Chris,
when I do 'cd'=> and after 'pwd' => home/user_name,
therefore should i change the commands from:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
to:
echo 'export PATH="$HOME/user_name/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
???

Reply

Hey there! This guide was VERY useful, as every other guide on the subject I found had untold errors along the way. This one worked perfectly, up one of the very last steps after installing postgresql, where you select it using this:

rails new myapp -d postgresql

I receive this error:

/home/event/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /home/event/.rbenv/versions/2.6.5 in PATH, mode 040777
sh: 1: node: not found
sh: 1: nodejs: not found
Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/

I installed NodeJS, but I'm still receiving this error. I tried to proceed to the next part regardless, but on this portion of code:

rake db:create

I receive this error:

could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Couldn't create 'myapp_development' database. Please check your configuration.
rake aborted!
ActiveRecord::NoDatabaseError: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


Caused by:
PG::ConnectionBad: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

Tasks: TOP => db:create
(See full trace by running task with --trace)

Apologies for the long help request! I'm just starting out in coding, and getting my development environment set up on Windows is taking a good chunk of my time by itself unfortunately.

Reply

i have a same error... please rescue us

Reply

any luck with this?

Reply

someone has solved this problem, please help

Reply

How did you fix this problem... please help

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.