在 Ubuntu 上使用 WSL2 安装 Ruby 时出现 RVM 错误:运行“__rvm_make -j16”时出错

1 ubuntu development-environment windows-subsystem-for-linux

我在重新安装 Windows 10 后重新安装我的环境。我得到了安装 WSL2 并使用 Ubuntu 发行版、nvm、node.js、rvm 和 ruby​​ 的说明。我的组织特别希望我们使用 ruby​​ 版本 2.7.4。我确信,如果我发布了不允许的完整说明,但我将发布他们告诉我们运行的代码,看看是否有人知道我为什么会收到此错误。我之前已经让它在这台机器上工作,并且这些步骤在其他 Windows 机器上是可重复的,因为我在我的笔记本电脑上设置了环境。

\n

以下是我被告知要遵循的步骤:

\n

1. Install Windows Subsystem for Linux (WSL) and Ubuntu\n\xe2\x80\xa2 Search for the "Command Prompt" application using the "Start" menu\n\xe2\x80\xa2 Select "Run as administrator" from the right side of the search window\n\xe2\x80\xa2 Allow the program to make changes to your device and wait for the "Command Prompt" application to open\n\xe2\x80\xa2 Type wsl --install -d Ubuntu and press \n\xe2\x80\xa2 The terminal should output "The requested operation is successful."\n\xe2\x80\xa2 Restart your computer to complete the installation.\n\xe2\x80\xa2 Open the "Ubuntu" application\n\xe2\x80\xa2 When it says "Enter new UNIX username:" add a simple username and press (Note: usernames may not start with a number, and may not include capital letters)\n\xe2\x80\xa2 Where it says "New password:" add a simple password and press (Note: you will not see any text when you are typing your password.)\n\xe2\x80\xa2 Where it says "Retype new password:" retype the same password from before and press (Note: store this password somewhere safe. You will need it to be able to run commands in the future)\n\xe2\x80\xa2 The terminal should output "Installation successful!" and then print about 50 lines that you can ignore\n\xe2\x80\xa2 Type wsl --set-default-version 2 into the terminal and press (Note: you should see a message starting with "For information on key differences\xe2\x80\xa6")\n\xe2\x80\xa2 Type wsl --status into the terminal and press . You should see a message including "Default Version 2", which verifies that the default version has been set correctly.\n\xe2\x80\xa2 Type wsl --set-version Ubuntu 2 into the terminal and press \nWait for the "Conversion complete" or "This distribution is already the requested version" message in the terminal\n\xe2\x80\xa2 Type wsl --list --verbose into the terminal and press . You should see a message including "NAME Ubuntu VERSION 2", which verifies that the default version has been set correctly.\n2. Install Node Version Manager (NVM) on Ubuntu\n\xe2\x80\xa2 Open the "Ubuntu" application using the "Start" menu\n\xe2\x80\xa2 Type curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash and press \n\xe2\x80\xa2 Close the "Ubuntu" application\n\xe2\x80\xa2 Reopen the "Ubuntu" application\n\xe2\x80\xa2 Type nvm and press \n\xe2\x80\xa2 If you see a message ending with "Note: to remove, delete, or uninstall nvm", continue below.\n3. Install Node.js on Ubuntu\n\xe2\x80\xa2 Open the "Ubuntu" application using the "Start" menu\n\xe2\x80\xa2 Type nvm install --lts and press \n\xe2\x80\xa2 Type nvm list and press \n\xe2\x80\xa2 If you see a message starting with "-> v16.0.0" (or any higher number, like "-> 16.11.1"), continue to the next lesson\n4. Install Ruby Environment Manager (RVM) on Ubuntu\n\xe2\x80\xa2 Open the "Ubuntu" application using the "Start" menu\n\xe2\x80\xa2 Type sudo apt-get install software-properties-common and press \nYou may be asked to enter your Ubuntu terminal password\n\xe2\x80\xa2 Type sudo apt-add-repository -y ppa:rael-gc/rvm and press \n\xe2\x80\xa2 Type sudo apt-get update and press \n\xe2\x80\xa2 Type sudo apt-get install rvm and press (Note: if you are asked "Do you want to continue [Y/n]", type "Y" and press )\n\xe2\x80\xa2 Type sudo usermod -a -G rvm $USER and press \n\xe2\x80\xa2 Close the "Ubuntu" application\n\xe2\x80\xa2 Open the "Ubuntu" application using the "Start" menu\n\xe2\x80\xa2 Type rvm and press \n\xe2\x80\xa2 If you see a long message ending in "For additional documentation, please visit https://rvm.io\nThis is an external link.", continue below\n5. Install Ruby Version 2.7.4 on Ubuntu (This is the part I can\'t get to work)\n\xe2\x80\xa2 Open the "Ubuntu" application using the "Start" menu\n\xe2\x80\xa2 If the "Ubuntu" application is still open from the last step, close and re-open to prevent errors with running the next command.\n\xe2\x80\xa2 Type rvm install 2.7.4 --default and press \n\xe2\x80\xa2 Enter your Ubuntu password if prompted\n\xe2\x80\xa2 Type rvm list and press \n\xe2\x80\xa2 If you see a message starting with =* ruby-2.7.4, continue below\n\xe2\x80\xa2 If you encounter issues installing a version of Ruby via RVM, try the following in Ubuntu:\n\xe2\x80\xa2 Run rvm group add rvm $USER\n\xe2\x80\xa2 Close Ubuntu and reopen\n\xe2\x80\xa2 Run rvm fix-permissions\n\xe2\x80\xa2 After running the last command, try installing Ruby again with rvm install 2.7.4 --default\n\xe2\x80\xa2 If you are continuing to have issues installing RVM, try running the following:\n$ sudo usermod -a -G rvm $USER\n\xe2\x80\xa2 After running, try installing Ruby again.

\n

The install seems to fail when compiling and I get this error message:

\n

"Error running \'__rvm_make -j16\',\nplease read /home/dylan9706/.rvm/log/1671650995_ruby-2.7.4/make.log

\n

There has been an error while running make. Halting the installation."

\n

Any help would be appreciated. Thanks!

\n

Fru*_*der 9

我也遇到了完全相同的问题。经过谷歌搜索后,我发现 Ubuntu 22.04.1 LTS 使用不同版本的 openssl,我认为是 3。您需要版本 1 的 open ssl 来安装旧的 ruby​​ 二进制文件。这就是我所做的

  1. $ sudo apt install build-essential
  2. $ cd ~/下载
  3. $ wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
  4. $ tar zxvf openssl-1.1.1g.tar.gz
  5. $ cd openssl-1.1.1g $ ./config --prefix=$HOME/.openssl/openssl-1.1.1g --openssldir=$HOME/.openssl/openssl-1.1.1g
  6. $ 制作
  7. $ make test(你可能会遇到一些测试失败但忽略)
  8. $ 进行安装
  9. $ rm -rf ~/.openssl/openssl-1.1.1g/certs
  10. $ ln -s /etc/ssl/certs ~/.openssl/openssl-1.1.1g/certs
  11. $ CD ~
  12. $ rvm install ruby​​-XXX --with-openssl-dir=$HOME/.openssl/openssl-1.1.1g (其中 ruby​​-XXX 是您要安装的版本