简体   繁体   English

在Linux Mint中开始Ruby on Rails

[英]Beginning Ruby on Rails in Linux Mint

This may sound very basic to many of you. 对于许多人来说,这听起来很基础。 I have just started a Ruby on Rails tutorial in Linux. 我刚刚在Linux中开始了Ruby on Rails教程。 I'm very new to the Linux OS. 我是Linux操作系统的新手。 I have installed a rvm. 我已经安装了rvm。 But I am unable to install Rails. 但是我无法安装Rails。 It's saying "cant load such file --zlib". 这就是说“无法加载此类文件--zlib”。 And I can see two source files for Ruby. 我可以看到两个Ruby的源文件。 Not sure if I have two Ruby installed. 不知道我是否安装了两个Ruby。

Just take a note that you have selected the correct build system: 请注意您选择了正确的构建系统:

"Tools -> Build System -> Ruby"

Then press CTRL+B . 然后按CTRL+B This should work. 这应该工作。

您可以使用ctrl + b崇高地执行.rb文件。

It seems you are a bit confused about how Ruby on Rails work. 您似乎对Ruby on Rails的工作方式有些困惑。 Sumblime can run your ruby code but not on Rails stack. Sumblime可以运行您的ruby代码,但不能在Rails堆栈上运行。 My suggestion it's to work always with an open terminal on the directory of your rails application. 我的建议是始终与rails应用程序目录上的打开终端一起使用。 Let's assume you created a new rails project as 假设您创建了一个新的rails项目,

rails new helloWorld

The rails generetor will create a subfolder helloWorld.This will be your working directory in the terminal. rails生成器将创建一个子文件夹helloWorld。这是您在终端中的工作目录。 So you have to do: 因此,您必须执行以下操作:

cd helloWorld

and then 接着

rails s

It will run your rails application on an embedded server on localhost:3000 by default. 默认情况下,它将在localhost:3000的嵌入式服务器上运行rails应用程序。

What method did you use to install ruby? 您使用什么方法安装红宝石?

If you compiled from source you may need to do 如果从源代码编译,则可能需要执行

   sudo apt-get install libssl-dev

And then recompile ruby 然后重新编译红宝石

Otherwise, you may not have the most recent version of Rubygems 否则,您可能没有Rubygems的最新版本。

Try: go to https://github.com/rubygems/rubygems/releases/tag/v2.2.3 尝试:转到https://github.com/rubygems/rubygems/releases/tag/v2.2.3

download rubygems-update-2.2.3.gem 下载rubygems-update-2.2.3.gem

call the directory where the file was dl'ed, then 调用文件被删除的目录,然后

   gem install rubygems-update-2.2.3.gem

   update_rubygems --no-ri --no-rdoc

   rubygems --version #Should show 2.2.3

   gem install rails

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM