I'm new to Ruby on Rails (and programming!) and am running through the guide here...
http://guides.rubyonrails.org/getting_started.html
However I am stumped on step 4.1. Creating a webserver as Webrick does not seem to run at all. Here is the error message that I see...
F:/Documents/Google Drive/Development/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4
.2.0/lib/rails/app_rails_loader.rb:39:in `exec': No such file or directory - "F:
/Documents/Google Drive/Development/Ruby21/bin/ruby.exe" (Errno::ENOENT)
The Ruby.exe does indeed exist in this location, all previous steps have been fine up until now. Any help would be much appreciated!
Is Ruby and Rails installed locally or is it in an external flash drive or cloud storage? You might need to reinstall everything into your C:\ drive to run a local server.
Also, did you copy the command from the guide verbatim? If you're running windows and using a cmd prompt, you don't need to include the "bin/" part of that command. Simply enter "rails server" or "rails s" for short to start the server.
Related
I have created the new rails project and trying to run it without doing any changes. I am using the power shell in windows 10. When I am running the rails s command its not starting the server. Please see attached image. I have highlighted the installed ruby version.
The error is there in the output, you do not have a rails app to start a server for, you can create a new app with:
rails new <name-for-your-app>
Follow along this tutorial
to help you get started with rails.
I think this command will work or you are missing something which is required to run rails server
bin/rails server
I've got similar error when I am not in rails project directory. Seems you are out of directory.
Please run those full commands in powershell
cd c:/
rails new testapp
cd testapp
rails s
I have a regular Rails project that is up and running fine, using Rails 5.1.3.
I recently discovered Rails runner and tried it along the documentation (https://guides.rubyonrails.org/command_line.html#rails-runner).
However, my Rails runner seems to be incapable of coping with files. I have a file lib/manual_exports/my_export.rb, and it really exists. I tried running
rails runner lib/manual_exports/my_export.rb
and
rails runner ./lib/manual_exports/my_export.rb
I always get the response
Please specify a valid ruby command or the path of a script to run.
Run 'bin/rails runner -h' for help.
undefined local variable or method `lib' for #<Rails::Command::RunnerCommand:0x00007fb13008b310>
# (or `.' instead of `lib')
This sounds as if runner thought my path was a Ruby command, which shouldn't be the case.
When I try reading in the file directly like
rails runner "eval(File.read 'lib/manual_exports/my_export.rb')"
or
rails runner "eval(File.read '#{Rails.root}/lib/manual_exports/my_export.rb')"
I get no answer at all, until I press ctrl+C, which gives me the stack trace
/Users/marion/.rvm/gems/ruby-2.4.2/gems/railties-5.1.3/lib/rails/commands/runner/runner_command.rb:37:in `read': No such file or directory # rb_sysopen - lib/manual_exports/my_export.rb (Errno::ENOENT)
I tried running a command directly (rails runner 'puts "hi"'), which worked. However, it took incredibly long - about two seconds. Can anybody explain to me what is happening here? Thank you!
I've been working on a project the last few days, and I've been struggling with an error when starting up my rails server with the 'rails server' command. I have searched the whole internet for an answer but I dont really seem to find a solution to my problem.
The problem is that when I launch rails server with the command I get this output:
Output as seen on image.
It looks to me like you need to install Redis.
There is a Gem for that and you can see the installation instructions HERE
I have use the instant rails. In ruby console window I have created a new ruby rails application but I can't run the file server from the script folder.
To run it i used script/server command. it says "server" is not recognized internal or external command.
I am not running windows as administration
I personally don't know what your environment looks like but it looks like instant rails isn't maintained anymore (discontinued in 2007).
That being said it might be that you're not running the script using a Ruby executable.
I would personally suggest switching to RailsInstaller or RubyStack.
I have got an application which was zipped and I unzipped the files and it gave me a folder with all the required structure of a rails application. But when I am going inside the directory and running the rails server command, its not doing anything, but showing me the list of options rails command can do. What would have been the problem?
thanks
Maybe this will help from app folder try:
ruby script/rails server
As explained by Dave Isaacs, Showing the list of options is what the rails command does when it is executed outside the context of an application (i.e., not in the application directories).
Type the full command, including the /script path to the CLI.
script/rails server
instead of
rails server
where script is the path to the rails command that, in a Rails 3 application, lives in the script folder.
I would assume that the application you got was written with rails 2.x. In that case, you have to start it with
script/server