0

When I type "rails new ..." it goes well until it reaches:

run  bundle install

C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/win32/registry.rb:71:in `find':unknown encoding name - CP720 (ArgumentError)

I have already changed the encoding name by " chcp 1252 " which I found in another answer, because it was giving me

unknown encoding name - CP720 (ArgumentError)

When I was trying to know the version of the rails through " rails -v "

If anyone knows how to solve this please tell me , and if you need more information tell me what you need to know and I will type it in a comment .

Update : it doesn't do that any more , it now says:

Installing nio4r 1.2.1 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

And at the end it says:

An error occurred while installing nio4r (1.2.1), and Bundler cannot continue. Make sure that gem install nio4r -v '1.2.1' succeeds before bundling.

Community
  • 1
  • 1
Mfms99
  • 143
  • 1
  • 1
  • 7
  • I see that you found the duplicate, but there are other seemingly valid workarounds listed as alternate answers. Have you tried editing `registry.rb`? – MarsAtomic Jul 19 '16 at 20:36
  • i actually have put "LOCALE = Encoding::UTF_8" in line 71 in registry.rb . the problem is that i have done many changes , and i am afraid that they might cause failure to each other . – Mfms99 Jul 19 '16 at 22:37
  • In matter of fact ,Every time i do something new i get different response from rails ,but it still doesn't work . now it gives me this when I try to make new app with "rails new" : " An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling." But when I try to run "bundle install " it says : " C:\Users\admin>bundler install The system cannot find the path specified. " i am really confused now LOL . – Mfms99 Jul 19 '16 at 22:54
  • Can you open `C:\RailsInstaller\Ruby2.2.0\bin\bundle.bat` and search for the string `emachnic`. If you can find it, we can do some editing to get you on your feet. – MarsAtomic Jul 20 '16 at 01:22
  • thank you for your concern . That string was in bundle.bat and i edited it and put "C:\RailsInstaller\Ruby2.2.0\bin\ruby.exe" "%~dpn0" %* ". I think that the problem is different now , maybe if I could install " nio4r " the " bundle install " might work , honestly i am not sure what "nio4r'' is ,but i am going to try anyway . Now i am having a course on "coursera" ,but in the video of installation which is about 10 m these problems didn't happen . – Mfms99 Jul 20 '16 at 09:33
  • I wanted to ask you if it was normal to see this when I open the command prompt : " C:\Sites> " , because in the video there was only " C:\> " – Mfms99 Jul 20 '16 at 09:40
  • note that now i have rails 5.0.0 , ruby 2.2.4 , git 1.9.4 – Mfms99 Jul 20 '16 at 09:51
  • nio4r is [New Input/Output for Ruby](https://github.com/celluloid/nio4r). You could try `bundle update nio4r` to address that issue. Also, the `emachnic` string exists in a number of `.bat` files and has to be corrected in each. – MarsAtomic Jul 20 '16 at 13:30
  • should i remove all syntax that have " emachnic " in it and put "C:\RailsInstaller\Ruby2.2.0\bin\ruby.exe" "%~dpn0" %* " ? – Mfms99 Jul 20 '16 at 17:54

1 Answers1

0

RailsInstaller seems to include an unresolved (and continuing) problem with their builds. If you look in your .bat files, you'll find the following lines, which indicate that RailsInstaller is using a hardcoded path that refers to the machine of a specific RailsInstaller developer:

@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.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
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" "%~dpn0"

Any instance of the previous code should be replaced with the following:

@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" %*

If all else fails and you just don't want to deal with it, the RailsInstaller web page includes multiple versions, so you can just go back and use an earlier version (particularly if you're starting a new project).

MarsAtomic
  • 10,436
  • 5
  • 35
  • 56
  • I reinstalled rails and did as you said , now it returns this when i type bundle install : " C:\Sites\nein>bundle install C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/win32/registry.rb:71:in `find': unknown encoding name - CP720 (ArgumentError) " do you think I should change the encoding name by " chcp 1252 " ? – Mfms99 Jul 20 '16 at 20:09
  • Yeah. We've been working backwards trying to resolve related problems, and now we're back to the original, so do what you did when CP720 was the top error. – MarsAtomic Jul 20 '16 at 20:15
  • I noticed something strange , every line starts with " C:\Sites> " , when i saw videos on rails there was only " C:\> " , is that normal ? – Mfms99 Jul 20 '16 at 21:07
  • "Every line " where? Help a brother out, I can't see your terminal from here. ;) If you're talking about your command prompt, it just means you're in your Sites directory. – MarsAtomic Jul 20 '16 at 21:09
  • yes my command prompt , it looks like that : " The system cannot find the path specified. C:\Sites> " , but what is "Sites directory " ? , I know it is probably a stupid question , but I am still a beginner and there is so much to learn . – Mfms99 Jul 20 '16 at 21:18
  • c:\ is the root directory of your hard drive (the very top). c:\Sites means you've moved into a folder called Sites that's immediately inside your hard drive. The tutorial you saw with c:\ just means that the presenter wasn't in any folders and was saving data at the top of the hard drive. Now, is bundle install working? I'd like to resolve this question ASAP, since it's dragging out far beyond the norm and you probably want to get back to work. – MarsAtomic Jul 20 '16 at 22:08
  • at first it was returning " unknown encoding name argument error " or something like that ,so i typed " gem install rails " ,but it returned at the end " ERROR: Failed to build gem native extension. " , so i typed " gem install rails -v 4.2.3 " and it worked fine with no errors , then I typed "rails new my_project5" , but the bundle install couldn't continue , and it says that nio4r isn't couldn't be installed because of native extensions once again , here are the logs : http://pastebin.com/X9sH6zH3 , it was going well until line 117 . – Mfms99 Jul 20 '16 at 22:32
  • Really sorry, but your questions are way too disorganized. Stack Overflow is meant to provide specific answers to specific questions, but you've made at least two posts where you ask the same series of things in each question. I cannot continue until you properly organize things. Ask one question. Solicit answers for that one question. Apply the suggestions. Move on only when the problem of that moment is resolved. What I'd do is delete all of your Ruby and Rails stuff and start over again using Vagrant. Using Windows at your level is asking for trouble. – MarsAtomic Jul 20 '16 at 23:01
  • Ok my friend , sorry if I had been annoying . Thank you for your help and advice . I will try to be better than that in the future . – Mfms99 Jul 21 '16 at 04:36
  • Sorry if that sounded more harsh than I meant -- it can be difficult to convey nuance in writing. What I mean is that we need to stick to one question at a time before jumping down the rabbit hole. So far, I can't really tell which of my suggestions you've implemented and what the results were because as soon as I think we've moved on to the next thing, we're back to the first. Really though, wiping your project clean and installing Vagrant will give you a unix style environment where you won't run into these problems. Many libraries were written for unix, so Windows produces problems. – MarsAtomic Jul 21 '16 at 05:45
  • it finally worked , I now understand how this works , thank you for your help . this was the thing i never tried and it was the solution : http://jekyll-windows.juthilo.com/1-ruby-and-devkit/ – Mfms99 Jul 21 '16 at 23:00
  • Hmm. All this time, I thought you'd tried to install DevKit already. Well, glad it's resolved for you. Best of luck on your project. – MarsAtomic Jul 21 '16 at 23:09
  • actually what was confusing to me is that every time i close the command prompt and open it again i have to do every thing from the start , i mean that i have to change the encoding name , some times reinstall the bundle . but i just knew that after every thing worked . before it worked i thought that i was facing a new error so i got confused and thought that the first solution was wrong. Any way , I am glad it is finally over after three days i am finally able to run the server LOL . Best wishes to you too . – Mfms99 Jul 22 '16 at 01:07