Windows 上的 Ruby on Rails 问题[msvcrt-ruby18.dll 错误] - 新手问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2167992/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:51:26  来源:igfitidea点击:

Problem with Ruby on Rails on Windows[msvcrt-ruby18.dll error] - newbie questions

ruby-on-railswindows

提问by Miroslav Lazovich

I have installed Ruby 1.9.1 recently. Everything went fine, I installed the devkit, gems, rails and decided to use RadRails IDE. But, when I typed "ruby script/server" command, I got the error message telling me that msvcrt-ruby18.dll was not found. Still, I was able to run the WEBrick server. I also tried to open "http://localhost:3000" in my web browser - everything was fine, except this: when I clicked "About your application's environment", I got the error message that "something is not working" (or something similar). My OS is Vista Ultimate 64-bit. I have several questions: 1. I did some research and it seems that the problem is with the gem binaries - they are built on another version. If this is the case, how can I fix this? Should I use previous version of Ruby? Which version should I use? And, how serious is this problem? Am I missing something? 2. It seems that Aptana RadRails IDE installs all the needed gems when it is started for the first time. I guess that you do not need to install those gems manually after Ruby installation? 3. Should I run Ruby on Ubuntu instead? I can install Virtual Box and run the Ubuntu.

我最近安装了 Ruby 1.9.1。一切顺利,我安装了 devkit、gems、rails 并决定使用 RadRails IDE。但是,当我输入“ruby script/server”命令时,我收到错误消息,告诉我找不到 msvcrt-ruby18.dll。尽管如此,我还是能够运行 WEBrick 服务器。我也尝试打开“ http://localhost:3000“在我的网络浏览器中 - 一切都很好,除了这一点:当我单击“关于您的应用程序环境”时,我收到错误消息“某些东西不起作用”(或类似的东西)。我的操作系统是 Vista Ultimate 64 位。我有几个问题: 1. 我做了一些研究,似乎问题出在 gem 二进制文件上——它们是建立在另一个版本上的。如果是这种情况,我该如何解决这个问题?我应该使用以前版本的 Ruby 吗?我应该使用哪个版本?还有,这个问题有多严重?我错过了什么吗? 2. Aptana RadRails IDE 似乎在第一次启动时安装了所有需要的 gem。我猜你不需要安装安装 Ruby 后手动安装那些 gems?3. 我应该在 Ubuntu 上运行 Ruby 吗?我可以安装 Virtual Box 并运行 Ubuntu。

Thanks!

谢谢!

采纳答案by therin

I tried switching from Windows to Ubuntu and had the same, if not more trouble getting Ruby + Rails to work properly. In my opinion Rails especially is still in a state where if you aren't personally involved in the project, it is very hard to start using. I hear a lot of people talk about how easy it is to use Ruby on Rails, when in reality if you want to create anything more than a blog application (which is what 99% of it's tutorials are about) you end up spending just as much time as with any other framework.

我尝试从 Windows 切换到 Ubuntu 并且遇到了同样的问题,如果不是让 Ruby + Rails 正常工作更麻烦的话。在我看来,Rails 尤其还处于一种状态,如果您不亲自参与该项目,则很难开始使用。我听到很多人谈论使用 Ruby on Rails 是多么容易,但实际上,如果您想创建的不仅仅是博客应用程序(这是其中 99% 的教程的内容),您最终的花费与与任何其他框架一样多的时间。

Update- A year later.

更新- 一年后。

I've tried Ruby on Rails again and this time started out with Rails Installer, a really easy way to get Rails running on Windows (although it is frustratingly slow sometimes). All in all, the Rails Tutorialis definitely the best way to learn Rails.

我再次尝试了 Ruby on Rails,这次是从Rails Installer开始的,这是一种让 Rails 在 Windows 上运行的非常简单的方法(尽管有时速度慢得令人沮丧)。总而言之,Rails 教程绝对是学习 Rails 的最佳途径。

回答by srboisvert

I fought with windows ruby development for over a year. I gave up and switched to Ubuntu and am quite happy with it.

我与 windows ruby​​ 开发斗争了一年多。我放弃并转而使用 Ubuntu,对此我感到非常满意。

When I switched i got the following benefit: -about a 30% ruby speed increase -gems just install properly and work - native libraries build. -my development machine now matches my deployment environment -none of the windows ssh key hassles. -about a quarter of my debugging mental space was freed up by not wondering "Is this a windows problem or my code?" -far less yak shaving

当我切换时,我得到了以下好处: - 大约 30% 的 ruby​​ 速度增加 -gems 只需正确安装并工作 - 本地库构建。- 我的开发机器现在与我的部署环境相匹配 - 没有 windows ssh 密钥的麻烦。- 通过不去想“这是 Windows 问题还是我的代码?”,我释放了大约四分之一的调试心理空间。- 少剃牦牛毛

Now to address your specific problem try the steps outlined in this messageand the one that follows it.

现在,要解决您的特定问题,请尝试执行此消息及其后的步骤中概述的步骤。

Good luck

祝你好运

回答by Charles Roper

The current release version 1.1.5 of Mongrel is incompatible with Ruby 1.9 and throws this error when it is run. It's easy to solve - just make sure Rubygems is up-to-date:

Mongrel 的当前发行版 1.1.5 与 Ruby 1.9 不兼容,并在运行时抛出此错误。这很容易解决 - 只需确保 Rubygems 是最新的:

gem update --system

Then install the new pre-release version of Mongrel:

然后安装 Mongrel 的新预发布版本:

gem install mongrel --pre

回答by 2potatocakes

Had the exact same error trying to run Heroku on Windows. Missing msvcrt-ruby18.dll

尝试在 Windows 上运行 Heroku 时出现完全相同的错误。缺少 msvcrt-ruby18.dll

Cloverink's fix is spot on though!

Cloverink 的修复是正确的!

Make sure you've got DevKit installed to help build gems properly first. Uninstall json gem and re-install using:

首先确保您已安装 DevKit 以帮助正确构建 gem。卸载 json gem 并使用以下命令重新安装:

gem install json --platform=ruby -v 1.4.6

宝石安装 json --platform=ruby -v 1.4.6

回答by luis

I also had the same problem, you need to install Devkit here is the process you need to follow, It is very important that at the end you install what potatocakes said :

我也有同样的问题,你需要安装 Devkit这里是你需要遵循的过程,最后你安装土豆蛋糕说的很重要:

gem install json --platform=ruby -v 1.4.6

Otherwise it is going to install 1.5.0 and it will give you another error.

否则它会安装 1.5.0 并且会给你另一个错误。

I last about 5 complete days to finally clone the application without any help. If you are here you are very near to be able to clone or edit your application, don't give up.

我持续了大约 5 天,最终在没有任何帮助的情况下克隆了应用程序。如果您在这里,您将非常接近能够克隆或编辑您的应用程序,请不要放弃。

回答by Jim

worked like a charm! but you need double dash "gem install json --platform=ruby". For the rails projects using bundler I got the gem and put it into the project. This code in Gemspec enabled us to isolate this issue. if RUBY_PLATFORM =~ /linux/ gem 'json', '1.4.6' else gem 'json', '1.4.6', :path=>'vendor/gems' end

像魅力一样工作!但你需要双破折号“gem install json --platform=ruby”。对于使用 bundler 的 rails 项目,我得到了 gem 并将其放入项目中。Gemspec 中的这段代码使我们能够隔离这个问题。if RUBY_PLATFORM =~ /linux/ gem 'json', '1.4.6' else gem 'json', '1.4.6', :path=>'vendor/gems' end

回答by cloverink

Install DevKit and reinstall json ( gem install json -platform=ruby )

安装 DevKit 并重新安装 json ( gem install json -platform=ruby )