Ruby on Rails - Windows 7 上的新安装但无法运行 ruby​​ 命令,路径有问题吗?

发布于 2024-09-29 01:54:30 字数 837 浏览 2 评论 0原文

我刚刚在我的新计算机上安装了 ruby​​ on Rails(我之前使用的是 instantrails),我正在尝试完成所有设置。

我运行的是 Windows 7。所以我按照本教程中的说明进行操作。

http://blogupstairs.com/ruby- on-rails/installing-ruby-on-rails-on-windows-7/

我猜问题是步骤 3

“将新安装的 bin 目录添加到 Windows 系统中的路径:打开 Windows 资源管理器- >右键单击计算机图标->在控制面板主页中选择“高级系统设置”,然后单击“环境变量”按钮->在系统变量中单击“新建”并添加新的系统变量,如下所示: : RUBY_HOME ,变量值: C:\Ruby,然后将其添加到路径中,并将分号后面的 bin 添加到“Path”变量,如下所示: C:\Program Files\Common Files\Adobe\AGL;%JAVA_HOME %\bin;%ANDROID_HOME%\tools;%RUBY_HOME%\bin"

我设置创建了系统变量,但是当我尝试在应用程序的主目录中运行 script/generate 时,出现错误

“Ruby:没有这样的文件或目录--script/generate”

我检查了应用程序目录,脚本文件夹就在那里。如何从控制面板运行“ruby script/generate”命令?

我猜测这是路径问题,但我不知道有什么方法可以检查以找出问题所在。

I just installed ruby on rails on my new computer ( I was using instantrails before) and I'm trying to get everything setup.

Im running Windows 7. So I followed the instructions from this tutorial.

http://blogupstairs.com/ruby-on-rails/installing-ruby-on-rails-on-windows-7/

The problem i'm guessing is step 3

"Add the newly installed bin directory to your path in your windows system : Open windows explorer-> right click the icon computer-> choose Properties -> in the contol panel Home, Click Advanced system settings and then click Envitonment Variables button->in the system variables click new and add new system variables like this : Variable name : RUBY_HOME , Variable Value : C:\Ruby, after that add it in to the path and add the bin after a semicolon to the “Path” variable like this : C:\Program Files\Common Files\Adobe\AGL;%JAVA_HOME%\bin;%ANDROID_HOME%\tools;%RUBY_HOME%\bin"

I set created the system variables but when I try to run script/generate in the main directory of my app I get the error

"Ruby: no such file or directory --script/generate"

I checked the apps directory and the script folder is in there. How can I run the "ruby script/generate" commands from the control panel?

I was guessing it was something with the path but I dont know any ways to check to find out whats going wrong.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

转身泪倾城 2024-10-06 01:54:30

您使用的是 Rails 3.0+ 吗?在此版本的 Rails 及更高版本中,script/* 文件夹已被弃用,取而代之的是 railsgeneraterailsserver 等。请参阅 此处

Are you using Rails 3.0+? In this version of rails and up, the script/* folder has been deprecated in favor of rails generate, rails server, etc. See here.

南巷近海 2024-10-06 01:54:30

在 99.99999% 的情况下,如果计算机告诉您在特定位置找不到文件,那是因为该文件不在该特定位置。

那么,当前目录中名为 script 的目录中是否真的存在一个名为 generate 的文件?

In 99.99999% of all cases, if a computer tells you that it cannot find a file at a specific location, it is because that file is not at that specific location.

So, is there actually a file named generate in a directory named script in the current directory?

二手情话 2024-10-06 01:54:30

我最近也在我的“干净”Win7 上安装了 RoR。

你使用什么IDE?

我建议尝试 JRuby 与 NetBeans/RubyMine:

  • JRuby 安装程序会完成所有工作(甚至将适当的变量添加到您的 系统环境设置中的路径...,
  • IDE负责gems,设置服务器等。

至于命令,正如 Nuclearsandwitch 提到的,Rails 3 中没有 script/generatescript/server只需确保您在目录中你的 Rails 应用程序,然后尝试运行 rails 服务器 它应该可以工作:-)。

I have recently installed RoR on my "clean" Win7 as well.

What IDE are you using?

I suggest trying JRuby with NetBeans/RubyMine:

  • JRuby installer does all the work (even adds the proper variables to your path in system environment settings...,
  • IDEs take care of gems, setting up servers etc.

As for the commands, as Nuclearsandwitch mentioned, there is no script/generate or script/server in Rails 3. Just make sure you in the directory with your Rails app and then try running rails server. It should work :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文