Problem with new Rails installation

I have recently installed a newer version of Rails, using the
RailsInstaller v2.0.1.0 for Windows. The installer seemed to run fine
with no errors, however, the command "$ rails new myapp" produces the
following error, and a Rails app that clearly doesn't work.

ArgumentError: invalid byte sequence in US-ASCII
An error occured while installing jquery-rails (1.0.19), and Bundler
cannot continue.
Make sure that `gem install jquery-rails -v '1.0.19'` succeeds before
bundling.

C:\Documents and Settings\Patrick Bayford\Desktop\myapp>rails server
[31mCould not find gem 'turn (>= 0) x86-mingw32' in any of the gem
sources listed in your Gemfile.
[0m
[33mRun `bundle install` to install missing gems.
[0m

Any ideas what the problem may be? And more importantly, how to fix it?

Several ideas, in fact.

Since rails is actually telling you are missing a gem, by all means
run the command:
bundle install

Make sure you are in your app's root when you do this.
If this solves your problem, great, if not continue to step below and
once that is done, run bundler again.

There may be a more insidious problem. No matter what environment you
are in, there is gonna be some code sometime that is written in C
probably for performance reasons. So you may need a compiler for that
and bundle may quit if it does not find one. Go to
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit and
install the DevKit.

SC

soldier.coder wrote in post #1046987:

Several ideas, in fact.

Since rails is actually telling you are missing a gem, by all means
run the command:
bundle install

Make sure you are in your app's root when you do this.
If this solves your problem, great, if not continue to step below and
once that is done, run bundler again.

There may be a more insidious problem. No matter what environment you
are in, there is gonna be some code sometime that is written in C
probably for performance reasons. So you may need a compiler for that
and bundle may quit if it does not find one. Go to
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit and
install the DevKit.

SC

I actually already have the DevKit - it is installed by the Rails
installer. I tried 'bundle install' - this yielded :-
C:\Documents and Settings\Patrick Bayford\Desktop\myapp>bundle install
Fetching source index for http://rubygems.org/
Using rake (0.9.2.2)
Using multi_json (1.0.4)
Using activesupport (3.1.1)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.1)
Using erubis (2.7.0)
Using rack (1.3.6)
Using rack-cache (1.1)
Using rack-mount (0.8.3)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.0.3)
Using actionpack (3.1.1)
Using mime-types (1.17.2)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.3.0)
Using actionmailer (3.1.1)
Using arel (2.2.1)
Using tzinfo (0.3.31)
Using activerecord (3.1.1)
Using activeresource (3.1.1)
Using ansi (1.4.2)
Using bundler (1.0.21)
Using coffee-script-source (1.2.0)
Using execjs (1.3.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.6.5)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.1.1)
Using coffee-rails (3.1.1)

ArgumentError: invalid byte sequence in US-ASCII
An error occured while installing jquery-rails (1.0.19), and Bundler
cannot continue.
Make sure that `gem install jquery-rails -v '1.0.19'` succeeds before
bundling.

So I ran `gem install jquery-rails -v '1.0.19'` - this yielded :-
C:\Ruby192>gem install jquery-rails -v '1.0.19'
ERROR: While executing gem ... (ArgumentError)
        invalid byte sequence in US-ASCII
Does this imply there is a problem with jquery-rails, or is this
something to do with my machine? I have seen this "invalid byte sequence
in US-ASCII"
in other places, most recently while trying to read a text file in Ruby!

Can you change the codepage of your Windows installation?

Use chcp from the command line and change to Latin one (1251 or 1252)
or Unicode (65001) and try gem install again.

I actually already have the DevKit - it is installed by the Rails
installer.

You got the Rails installer from http://rubyinstaller.org, right?
Humor me, then. Go to http://rubyinstaller.org/add-ons/ and see if
your latest matches theirs. I'm thinking that possibly the words "Add-
on" is a clue that perhaps the DevKit is NOT installed by the Rails
Installer. ; )

SC

soldier.coder wrote in post #1047045:

I actually already have the DevKit - it is installed by the Rails
installer.

You got the Rails installer from http://rubyinstaller.org, right?
Humor me, then. Go to http://rubyinstaller.org/add-ons/ and see if
your latest matches theirs. I'm thinking that possibly the words "Add-
on" is a clue that perhaps the DevKit is NOT installed by the Rails
Installer. ; )

SC

There definitely is a set of folders relating to DevKit that are
installed by the Rails installer - I will check with the site to make
sure.

soldier.coder wrote in post #1047045:

I actually already have the DevKit - it is installed by the Rails
installer.

You got the Rails installer from http://rubyinstaller.org, right?
Humor me, then. Go to http://rubyinstaller.org/add-ons/ and see if
your latest matches theirs. I'm thinking that possibly the words "Add-
on" is a clue that perhaps the DevKit is NOT installed by the Rails
Installer. ; )

SC

chcp does indeed change the code page, however, the change is NOT
persistent and reverts to the default (850).

But, it does solve the problem? if changing the codepage helps, I can
point you how to change it permanently. I thought was more important
determine if that is the cause and a possible fix :slight_smile:

For a permanent fix, please see this Cucumber wiki page:

https://github.com/cucumber/cucumber/wiki/Troubleshooting
http://codesnippets.joyent.com/posts/show/414

It involves edits to the registry.

Another recommendation: use a true type font for your console. Your
eyes will thank you later.

Luis Lavena wrote in post #1047227:

chcp does indeed change the code page, however, the change is NOT
persistent and reverts to the default (850).

But, it does solve the problem? if changing the codepage helps, I can
point you how to change it permanently. I thought was more important
determine if that is the cause and a possible fix :slight_smile:

For a permanent fix, please see this Cucumber wiki page:

https://github.com/cucumber/cucumber/wiki/Troubleshooting
http://codesnippets.joyent.com/posts/show/414

It involves edits to the registry.

Another recommendation: use a true type font for your console. Your
eyes will thank you later.

--
Luis Lavena

Just been able to do a thorough check - changing the code page has no
effect at all on this error. I append the results from a command-prompt
window.
C:\Ruby192>chcp 1252
Active code page: 1252

C:\Ruby192>gem install jquery-rails -v '1.0.19'
ERROR: While executing gem ... (ArgumentError)
    invalid byte sequence in US-ASCII

C:\Ruby192>chcp
Active code page: 1252

Can you run the same gem install command with -V?

gem install jquery-rails -v "= 1.0.19" -V

Use Pastie/Gist to post the entire backtrace

That will help us figure out where the error is coming from.

Also, ensure you have latest RubyGems (gem update --system)

Luis Lavena wrote in post #1047401:

Can you run the same gem install command with -V?

gem install jquery-rails -v "= 1.0.19" -V

Use Pastie/Gist to post the entire backtrace

That will help us figure out where the error is coming from.

Also, ensure you have latest RubyGems (gem update --system)

--
Luis Lavena

As you suggested I ran 'gem update --system' - this produced a couple of
errors (attachment 1)
I then ran 'gem install jquery-rails -v "= 1.0.19" -V', using a dos-pipe
to yield attachment 2. This also produced a few errors (attachment 3).
However, despite the errors, 'rails new myapp' now completes, although I
have NOT yet had a chance to test whether it runs!
It would appear that updating gems may have been the solution - odd on a
fresh install!!

Attachments:
http://www.ruby-forum.com/attachment/7073/GemUpdate.txt
http://www.ruby-forum.com/attachment/7074/tracer.txt
http://www.ruby-forum.com/attachment/7075/JQuery.txt

Have now tested the new Rails in myapp - hey presto it works fine, and
allowed me to access the Rails guide pages.
Problem solved apparently - thank you so much for your assistance Luis
Lavena.