# Error in environment.rb when starting rails on Windows

**URL:** <https://www.ruby-forum.com/t/error-in-environment-rb-when-starting-rails-on-windows/65583>\
**Category:** Rails\
**Created:** [August 19, 2006, 11:17am UTC](https://www.ruby-forum.com/t/error-in-environment-rb-when-starting-rails-on-windows/65583 "2006-08-19T11:17:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![srikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@srikanth](https://www.ruby-forum.com/u/srikanth)\
**Post date:** [August 19, 2006, 11:17am UTC](https://www.ruby-forum.com/t/error-in-environment-rb-when-starting-rails-on-windows/65583/1 "2006-08-19T11:17:24Z")

</div>

Hi,  
I have installed Ruby 1.8.4 and Ruby Gems 0.9.0.  
I have also downloaded rails-1.1.6 zip file and extracted it to a  
folder, say “rails”.

When I am trying to run the rails, by using the command “ruby  
script/server” from “rails” folder, I get following error, which shows  
syntax error on line 8 of config/environment.rb. If I comment, this  
line, then the WEBrick server starts up properly.

Any idea what might be going wrong?

====================START OF ERROR =================  
d:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_require': ./script/../config/../config/environment.rb:8: syntax error (SyntaxError) <%= '# ' if freeze %>RAILS_GEM_VERSION = '<%= Rails::VERSION::STRING %>' ^ from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
from  
./script/…/config/…/vendor/rails/activesupport/lib/active\_support/dependencies.rb:147:in  
`require' from ./script/../config/../vendor/rails/railties/lib/commands/servers/webrick.rb:52 from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
from  
./script/…/config/…/vendor/rails/activesupport/lib/active\_support/dependencies.rb:147:in  
`require' from ./script/../config/../vendor/rails/railties/lib/commands/server.rb:30 from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
from script/server:3

====================END OF ERROR =================

---

<div class="post-metadata">

**Author:** ![srikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@srikanth](https://www.ruby-forum.com/u/srikanth)\
**Post date:** [August 19, 2006, 1:56pm UTC](https://www.ruby-forum.com/t/error-in-environment-rb-when-starting-rails-on-windows/65583/2 "2006-08-19T13:56:44Z")

</div>

Whats the line 8 ?

On 8/19/06, Srikanth [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> from
> from
> 
> ```
> 
> >

–  
rm -rf / 2\>/dev/null - [http://null.in](http://null.in)

Dont judge those who try and fail, judge those who fail to try…

---

<div class="post-metadata">

**Author:** ![srikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@srikanth](https://www.ruby-forum.com/u/srikanth)\
**Post date:** [August 19, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/error-in-environment-rb-when-starting-rails-on-windows/65583/3 "2006-08-19T14:16:05Z")

</div>

Pratik Naik wrote:

> Whats the line 8 ?
> 
> On 8/19/06, Srikanth [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > ```
> > from
> > from
> > 
> > ```
> > 
> > >
> 
> –  
> rm -rf / 2\>/dev/null - [http://null.in](http://null.in)
> 
> Dont judge those who try and fail, judge those who fail to try…

Line 8 is :

\<%= '# ’ if freeze %\>RAILS\_GEM\_VERSION = ‘\<%= Rails::VERSION::STRING %\>’

As shown in error message in original post, the ruby interpreter is  
complaining at \<% in the beginning of line.

---

<div class="post-metadata">

**Author:** ![srikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@srikanth](https://www.ruby-forum.com/u/srikanth)\
**Post date:** [August 19, 2006, 3:42pm UTC](https://www.ruby-forum.com/t/error-in-environment-rb-when-starting-rails-on-windows/65583/4 "2006-08-19T15:42:15Z")

</div>

Srikanth wrote:

> Hi,  
> I have installed Ruby 1.8.4 and Ruby Gems 0.9.0.  
> I have also downloaded rails-1.1.6 zip file and extracted it to a  
> folder, say “rails”.
> 
> When I am trying to run the rails, by using the command “ruby  
> script/server” from “rails” folder, I get following error, which shows  
> syntax error on line 8 of config/environment.rb. If I comment, this  
> line, then the WEBrick server starts up properly.
> 
> Any idea what might be going wrong?

You shouldn’t download rails zip file directly but rather use:

gem install rails -y

instead.

Rails is not an instance of application (like it works with php  
applications for example.) It is framework which GENERATES applications.  
You have to install Rails (preferably using gems as described above)  
than use Rails to generate example application and then start this  
application. You can not start Rails themselves - and that is why gives  
you an error.

Google for Windows Rails installation tutorials to find out more.

Cheers,  
Bragi

---

<div class="post-metadata">

**Author:** ![srikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@srikanth](https://www.ruby-forum.com/u/srikanth)\
**Post date:** [August 19, 2006, 2:44pm UTC](https://www.ruby-forum.com/t/error-in-environment-rb-when-starting-rails-on-windows/65583/5 "2006-08-19T14:44:47Z")

</div>

Just write :

RAILS\_GEM\_VERSION = ‘1.1.8’

Or comment it if you’re using edge rails. This is needed when you have  
multiple rails gem installed.

-Pratik

On 8/19/06, Srikanth S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > >
> 
> As shown in error message in original post, the ruby interpreter is  
> complaining at \<% in the beginning of line.
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
rm -rf / 2\>/dev/null - [http://null.in](http://null.in)

Dont judge those who try and fail, judge those who fail to try…

---

<div class="post-metadata">

**Author:** ![srikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@srikanth](https://www.ruby-forum.com/u/srikanth)\
**Post date:** [October 25, 2006, 8:44pm UTC](https://www.ruby-forum.com/t/error-in-environment-rb-when-starting-rails-on-windows/65583/6 "2006-10-25T20:44:27Z")

</div>

Was this issue ever solved? I am getting a similiar error.

On Aug 19, 9:42 am, “Lukasz Piestrzeniewicz”

---

<div class="post-metadata">

**Author:** ![srikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@srikanth](https://www.ruby-forum.com/u/srikanth)\
**Post date:** [October 25, 2006, 9:09pm UTC](https://www.ruby-forum.com/t/error-in-environment-rb-when-starting-rails-on-windows/65583/7 "2006-10-25T21:09:18Z")

</div>

Well, I installed the rails using command “gem install rails  
–include-dependencies” and then, created the new application using  
“rails myapp”. I did not face this problem for “myapp”.

I am not quite sure how to use the zip version of rails. Rails when  
installed using “gem” works alright. The reason I tried the zip file  
version of Rails in first place was because I did not how to make the  
“gem install” work on a office PC which had internet proxy configured.  
It seems to work fine from my home PC.

removed\_email\_address@domain.invalid wrote:

> Was this issue ever solved? I am getting a similiar error.
> 
> On Aug 19, 9:42 am, “Lukasz Piestrzeniewicz”
