Forum: Ruby on Rails A little problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Matteo D. (Guest)
on 2006-01-24 19:55
Hi everyone,
I'm Matteo, I'm Italian, so sorry for my bad English.
I've just downloaded the "depot" examples, but I've an error:

# script/server
bash: script/server: /Users/dave/ruby1.8/bin/ruby: bad interpreter: No
such file or directory
matteod@bones:~/work/rails-code/depot8$

What's wrong? Would you mind suggesting me how to fix this problem?
I'm under Ubuntu Linux,
I'll appreciate any your answer,
THANKs,
Matte.
David C. (Guest)
on 2006-01-24 20:18
(Received via mailing list)
On 1/24/06, Matteo Dall'Osso <removed_email_address@domain.invalid> wrote:
> What's wrong? Would you mind suggesting me how to fix this problem?
> I'm under Ubuntu Linux,
> I'll appreciate any your answer,
> THANKs,
> Matte.
>
> --



Looks like your environment is not set up correctly.  script/server is
looking for ruby in /Users/dave/ruby1.8/bin.  Is it there? Probably not.
You can try to change that first line in script/serve to:

#!/usr/bin/env ruby

Dave
Matteo D. (Guest)
on 2006-01-24 21:06
> Looks like your environment is not set up correctly.  script/server is
> looking for ruby in /Users/dave/ruby1.8/bin.  Is it there? Probably not.
> You can try to change that first line in script/serve to:
>
> #!/usr/bin/env ruby
>
> Dave

Yes, you're right! THANKS !!!
But now I've another problem:

matteod@bones:~/work/rails-code/depot8$ script/server
bash: script/server: /usr/bin/: bad interpreter: Permission denied
matteod@bones:~/work/rails-code/depot8$

Both "ruby" and "ruby1.8" have these permissions:

root@bones:/usr/bin# ls -all ruby*
lrwxrwxrwx  1 root root    7 2005-11-13 18:13 ruby -> ruby1.8
-rwxrwxrwx  1 root root 3464 2005-10-07 18:10 ruby1.8

Many thanks!

MATTE!
Ben M. (Guest)
on 2006-01-25 02:09
(Received via mailing list)
Matteo Dall'Osso wrote:
> But now I've another problem:
>
> matteod@bones:~/work/rails-code/depot8$ script/server

That command should be "ruby script/server". You're invoking the ruby
interpreter with the argument "script/server".
Also, that argument is actually the path to a ruby script, so you have
to invoke this from the root directory of your
project (so that there actually is a "script" sub-directory with a
"server" script inside it).

On the other hand, you're on linux so maybe the "shebang" line
(#!/usr/bin/ruby) is enough to get the script to work...
someone set me straight if that's the case. In the meantime, try it with
"ruby ..."

b
Dudley F. (Guest)
on 2006-01-25 03:43
(Received via mailing list)
On Jan 24, 2006, at 6:08 PM, Ben M. wrote:

>
> On the other hand, you're on linux so maybe the "shebang" line (#!/
> usr/bin/ruby) is enough to get the script to work... someone set me
> straight if that's the case. In the meantime, try it with "ruby ..."

Yeah, you should be able to run "script/server" directly, assuming
the shebang line is correct. "#!/usr/bin/env ruby" should work if
there's a ruby in your $PATH. Having the wrong line endings in a
script will cause some weird "bad interpreter" messages, though, so
be careful of that.

=dudley
Ben M. (Guest)
on 2006-01-25 04:04
(Received via mailing list)
Dudley F. wrote:
>> interpreter with the argument "script/server". Also, that  argument is
> shebang line is correct. "#!/usr/bin/env ruby" should work if  there's a
> ruby in your $PATH. Having the wrong line endings in a  script will
> cause some weird "bad interpreter" messages, though, so  be careful of
> that.
>

Hm, yeah wrong line endings... have had that problem on linux in other
programming
languages. I found that opening with nano does the conversion
automatically (and then just
save the file)... SciTE has a menu option for that too.

b
This topic is locked and can not be replied to.