在Ubuntu Bash Windows 10上安装rails

时间:2016-05-13 13:12:46

标签: ruby-on-rails ubuntu rvm windows-10 rbenv

我正在使用启用了Bash的Windows 10 Insider。 lsb_release显示其Ubuntu 14.04 LTS。所以,我想知道最后我可以在Windows 10上安装RoR而不使用其他安装程序。因为他们在Windows上说它的Ubuntu。

我跟随Chris Oliver的GoRails Guide在Ubuntu 14.04 Win10上设置RoR。我尝试了两种方法,使用RVM& Rbenv,但我最终错误

我还要求Chris在他的网站上写一个指南,他认为这是一个好主意,但他唯一关心的是在Windows上用Linux软件打开端口并连接到它

我相信有人很快会找到一种在Windows 10上安装rails的方法,但同时我想知道它是否可能?如果是的话,我做错了什么。帮我解决一下。此外,我应该为此RVM或RBENV使用什么。在这种情况下哪个更好?

(注意:如果这看起来像两个不同的问题,请告诉我。我会编辑它。我甚至不知道它是否可能。修复错误是后面的部分。)

以下是rbenv错误消息:

$ 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错误消息:

-> 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

1 个答案:

答案 0 :(得分:12)

从构建 14342 开始,它似乎不可能,因为这是 Windows上的Bash 本身[1]的问题。

据报道,一些内部测试版本能够通过RVM安装ruby,但似乎这些版本中没有任何版本可用于快速版本。此时Windows Insiders的响铃[2]

更新:2016-05-27

更进一步:构建 14352 已于2016-05-26 [3]发布。运行apt-get update && apt-get upgrade后,我能够使用rvm和rbenv成功安装ruby-2.3.1

如下面的源#1所述,为了充分利用rvm,我需要使用/bin/bash --login运行bash。为实现此目的,我将其附加到 Bash on Windows上的Ubuntu 快捷方式的目标字段,如下所示:

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

现在我可以rvm use ruby-2.3.1 --defaultgem install railsrails new banana,但是当捆绑器尝试运行时,会出现错误:

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

更新:2016-06-03

据报道,即将发布的Windows Insider版本[4]中已修复cat: /dev/fd/63: No such file or directory错误,但这似乎并不致命。

作为捆绑程序错误的临时解决方法,发布chmod -R +t ~/.bundle/cache似乎可以解决问题,现在您可以安装有效的导轨[5]

来源:

  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