Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing rails on Ubuntu Bash Windows 10

I am using Windows 10 Insider built with Bash enabled. lsb_release shows its Ubuntu 14.04 LTS. So, I was wondering finally I can install RoR on Windows 10 and not use other installers. Because they say its Ubuntu on Windows.

I am following GoRails Guide by Chris Oliver to set RoR on Ubuntu 14.04 Win10. I tried both method using RVM & Rbenv but I ended up with errors

I also asked Chris to write a guide for this on his website and he thought it would be a great idea and but his only concern was opening up ports with Linux Software on Windows and connect to it

I am sure someone will soon find a way to install rails on Windows 10 but meanwhile I want to know if its possible or not? If yes what is it that I am doing wrong. Help me to fix it. Also what should I use for this RVM or RBENV. Which would be better in this case?

(Note: Please let me know if this looks like two different questions. I will edit it. I don't even know if its possible or not. Fixing errors is the later part.)

Here is rbenv error messages:

$ rbenv install 2.3.0
Downloading ruby-2.3.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.bz2
Installing ruby-2.3.0...

BUILD FAILED (Ubuntu 14.04 using ruby-build 20160426-12-gf03f7f8)

Inspect or clean up the working tree at /tmp/ruby-build.20160513120821.313
Results logged to /tmp/ruby-build.20160513120821.313.log

Last 10 log lines:
rm -f ../../../.ext/x86_64-linux/io/wait.so  *.o  *.bak mkmf.log .*.time
rm -f Makefile extconf.h conftest.* mkmf.log
rm -f core ruby *~
rmdir --ignore-fail-on-non-empty -p  2> /dev/null || true
make[2]: Leaving directory `/tmp/ruby-build.20160513120821.313/ruby-2.3.0/ext/io/wait'
make[1]: Leaving directory `/tmp/ruby-build.20160513120821.313/ruby-2.3.0'
Generating RDoc documentation
./ruby is not found.
Try `make' first, then `make test', please.
make: *** [rdoc] Error 1

RVM error messages:

-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.bz2
Installing ruby-2.3.0...

BUILD FAILED (Ubuntu 14.04 using ruby-build 20160426-12-gf03f7f8)

Inspect or clean up the working tree at /tmp/ruby-build.20160513120821.313
Results logged to /tmp/ruby-build.20160513120821.313.log

Last 10 log lines:
rm -f ../../../.ext/x86_64-linux/io/wait.so  *.o  *.bak mkmf.log .*.time
rm -f Makefile extconf.h conftest.* mkmf.log
rm -f core ruby *~
rmdir --ignore-fail-on-non-empty -p  2> /dev/null || true
cooldudeabhi@ACERASPIRE:~$ rvm install 2.3.0
ruby-2.3.0 - #removing src/ruby-2.3.0..
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/ubuntu/14.04/x86_64/ruby-2.3.0.ta                    r.bz2
Checking requirements for ubuntu.
Requirements installation successful.
df: Warning: cannot read table of mounted file systems: No such file or director                    y
ruby-2.3.0 - #configure
ruby-2.3.0 - #download
ruby-2.3.0 - #validate archive
cat: /dev/fd/63: No such file or directory
cat: /dev/fd/63: No such file or directory
The downloaded package for https://rubies.travis-ci.org/ubuntu/14.04/x86_64/ruby                    -2.3.0.tar.bz2,
Does not contains single 'bin/ruby' or 'ruby-2.3.0',
Only '' were found instead.
Mounting remote ruby failed with status 4, trying to compile.
df: Warning: cannot read table of mounted file systems: No such file or director                    y
Checking requirements for ubuntu.
Requirements installation successful.
grep: write error: Broken pipe
sort: fflush failed: standard output: Broken pipe
sort: write error
Installing Ruby from source to: /home/cooldudeabhi/.rvm/rubies/ruby-2.3.0, this                     may take a while depending on your cpu(s)...
ruby-2.3.0 - #downloading ruby-2.3.0, this may take a while depending on your co                    nnection...
ruby-2.3.0 - #extracting ruby-2.3.0 to /home/cooldudeabhi/.rvm/src/ruby-2.3.0..rvm install 2.3.0
like image 462
abhimanyuaryan Avatar asked May 13 '16 13:05

abhimanyuaryan


People also ask

What is the command to install rails?

To install Rails, use the gem install command along with the -v flag to specify the version. For this tutorial, you'll use version 6.1. 4.1 : gem install rails -v 6.1.

Can I run Ruby on Rails on Windows?

Install Ruby on Rails on Windows 10/11 Before starting, you will need to install the Git software package on your system. You can download it from the Git download page. Once the Git package is downloaded, follow the below steps to install Git on your system. Step 15 – Click on the Next to finish the installation.


1 Answers

It appears it isn't possible as of build 14342, as this is an issue with Bash on Windows itself [1].

Some internal testing builds are reported to be able to install ruby via RVM, but it does not appear any of these builds are currently available to the 'fast' ring of Windows Insiders at this time [2].


Update: 2016-05-27

One step closer: Build 14352 was released on 2016-05-26 [3]. After running apt-get update && apt-get upgrade I was able to successfully install ruby-2.3.1 using both rvm and rbenv.

As noted in source #1 below, in order to fully utilize rvm I needed to run bash with /bin/bash --login. To achieve this I appended it to the Bash on Ubuntu on Windows shortcut's target field like this:

C:\Windows\System32\bash.exe -c "cd ~ && /bin/bash --login"

Now I can rvm use ruby-2.3.1 --default, gem install rails and rails new banana, however when bundler tries to run, there is an error:

dozers@DRAGONSTONE:~/banana$ bundle
--- ERROR REPORT TEMPLATE -------------------------------------------------------
...
Error details

    ArgumentError: parent directory is world writable but not sticky
      /home/dozers/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tmpdir.rb:93:in `ensure in mktmpdir'
      /home/dozers/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tmpdir.rb:95:in `mktmpdir'
      /home/dozers/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:29:in `update'
...
--- TEMPLATE END ----------------------------------------------------------------

Unfortunately, an unexpected error occurred, and Bundler cannot continue.

First, try this link to see if there are any existing issue reports for this error:
https://github.com/bundler/bundler/search?q=parent+directory+is+world+writable+but+not+sticky&type=Issues

Update: 2016-06-03

The cat: /dev/fd/63: No such file or directory error is reported to be fixed in an upcoming Windows Insider release [4], but this doesn't seem to be fatal.

As a temporary workaround for the bundler error, issuing chmod -R +t ~/.bundle/cache appears to do the trick and now you have a working rails installation [5].


Sources:

  1. https://github.com/Microsoft/BashOnWindows/issues/9#issuecomment-207978726
  2. https://github.com/Microsoft/BashOnWindows/issues/222#issuecomment-214561156
  3. https://blogs.windows.com/windowsexperience/2016/05/26/announcing-windows-10-insider-preview-build-14352/
  4. https://github.com/Microsoft/BashOnWindows/issues/266#issuecomment-219576351
  5. https://github.com/bundler/bundler/issues/4630#issuecomment-223576426
like image 147
joe.holler Avatar answered Nov 14 '22 07:11

joe.holler