简体   繁体   English

重装RoR后系统找不到指定的路径

[英]The system cannot find the path specified after reinstalling RoR

I need some help with something that is driving me crazy.我需要一些帮助来解决让我发疯的事情。 After reinstalling RoR using RailsInstaller on Windows, I get a 'The system cannot find the path specified' error on the Windows command line.在 Windows 上使用 RailsInstaller 重新安装 RoR 后,我在 Windows 命令行上收到“系统找不到指定的路径”错误。 If I use Git Bash, however, the error is not shown and Rails works.但是,如果我使用 Git Bash,则不会显示错误并且 Rails 可以工作。

The path variable seems to be set correctly .路径变量似乎设置正确。 Ruby2.2.0\\bin, Git\\cmd are added to the path. Ruby2.2.0\\bin, Git\\cmd 被添加到路径中。

PATH VAR AFTER ADDING RAILS.BAT, FOLLOWING RAILSUSER SUGGESTION添加 RAILS.BAT 后的路径 VAR,遵循 RAILSUSER 建议

C:\RailsInstaller\Ruby2.2.0\bin;C:\RailsInstaller\Ruby2.2.0\bin\rails.bat;C:\RailsInstaller\Git\cmd;C:\Users\Sonia\AppData\Roaming\npm;C:\Program Files\AMI\DuOS\

Any idea how to fix this?知道如何解决这个问题吗? Thanks谢谢

The rails.bat file contained a wrong path. rails.bat 文件包含错误的路径。 @"C:\\Users\\emachnic\\GitRepos\\railsinstaller-windows\\stage\\Ruby2.2.0\\bin\\ruby.exe" Maybe it is one of the developers that worked on this. @"C:\\Users\\emachnic\\GitRepos\\railsinstaller-windows\\stage\\Ruby2.2.0\\bin\\ruby.exe"也许它是从事此工作的开发人员之一。

A temporary fix is to change the rails.bat file as the below code:临时修复是将 rails.bat 文件更改为以下代码:

@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
ECHO.This version of Ruby has not been built with support for Windows 95/98/Me.
GOTO :EOF
:WinNT
@"%~dp0ruby.exe" "%~dpn0" %*

step 1: open the rails.bat file(D:\\RailsInstaller\\Ruby2.2.0\\bin\\rails.bat)第一步:打开rails.bat文件(D:\\RailsInstaller\\Ruby2.2.0\\bin\\rails.bat)

step 2: Find the lines as look like this (for me line No 3 and 7) @"C:\\Users\\emachnic\\GitRepos\\railsinstaller-windows\\stage\\Ruby2.2.0\\bin\\ruby.exe"第 2 步:找到如下所示的行(对我来说是第 3 行和第 7 行) @"C:\\Users\\emachnic\\GitRepos\\railsinstaller-windows\\stage\\Ruby2.2.0\\bin\\ruby.exe"

step 3:Just replace with @"%~dp0ruby.exe" and save第 3 步:只需替换为@"%~dp0ruby.exe"并保存

After changing, Your file look like this更改后,您的文件如下所示

 @ECHO OFF
 IF NOT "%~f0" == "~f0" GOTO :WinNT
 @"%~dp0ruby.exe"
 "C:/Users/emachnic/GitRepos/railsinstaller-windows/stage/Ruby2.2.0/bin/rails" %1 %2 %3 %4 %5 %6 %7 %8 %9
 GOTO :EOF
 :WinNT
 @"%~dp0ruby.exe" "%~dpn0" %*

step 4: Repeat the same in bundle.bat file第 4 步:在bundle.bat文件中重复相同的操作

step 5:Run the command rails -v in command prompt第 5 步:在命令提示符下运行命令rails -v

Hope it Works..希望它有效..

The rails.bat file (for me located in C:\\RailsInstaller\\Ruby2.2.0\\bin) has a hard-coded path that is not accurate. rails.bat 文件(对我来说位于 C:\\RailsInstaller\\Ruby2.2.0\\bin)有一个不准确的硬编码路径。 Edit that file and add your path.编辑该文件并添加您的路径。

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

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