Error while running ruby server on text editor - ruby-on-rails

I am new to ruby on rail i have installed ruby on my system globally ruby -v command is working fine on my CMD but when i run it from other command prompt it give me not found error now i tried running it on my visual Code terminal and it is saying
"rails : The term 'rails' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again."
i need help with this please anyone

On a new ruby on rails project run this to install your dependencies
gem install bundler
bundle install

Related

Unable to integrate sqlite3 with ruby and rails

Disclaimer: I checked the FAQs. I have tried Google, Reddit and YouTube and am posting here after exhausting all available options.
I'm using guides.rubyonrails.org to learn. However, SQLite3 has not downloaded on my system, despite following the instructions on the website.
So I typed 'gem install sqlite3' in the command line and it has thrown multiple errors related to mingw32, mingw64 and msys. The commonality of the errors being they are invalid or corrupted databases (PGP signatures).
The final error stated for installing sqlite3 was "failed to build gem native extension" followed by the directory and a suggestion to install it from the net.
I have installed it from sqlite.org and integrated it with the regular command prompt. Here it says "connected to a transient in memory database".
It is not integrated in the command prompt with ruby. Here it says "the term 'sqlite3' is not recognised as the name of a cmdlet, function, script file, or operable program."
I'm using a laptop using Windows 10 and have rails 6.0.3.2 and ruby 2.7.1 installed.
I tried progressing irrespective and my input was 'rails server' on the regular command prompt.
The following lines showed up -
Could not find gem 'sqlite3 (~> 1.4) x64-mingw32' in any of the gem sources listed in your Gemfile.
Run 'bundle install' to install missing gems.
Please advise how to progress or if there's anything I'm missing. Should I persist and try and fix the error in the ruby command prompt or move forward with the regular command prompt? None of them are working for me to progress my learning. Let me know if you require more information.
Thanks for your time and help.
EDIT: Here is the image for when I run gem install sqlite3.
2nd EDIT: Here is what I get when I run 'rails new blog' and 'bundle install' thereafter.
3rd EDIT: Here is the mkmf file where the problem exists as per command prompt.
4th EDIT: I followed the instructions on guides.rubyonrails.org/getting_started.html. I ran 'bundle install' only when it asked me to after I ran 'rails new blog' in the command line.
Similar error regarding mingw32, mingw64 and msys from the first image came up after I ran bundle install in blog. However, this time it stated Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

Rails command not working on Windows command line

I installed Ruby and Rails and set-up the PATH to "C:\Rails\Ruby2.3.0\bin", but when I try to run commands with rails, I get the error message:
The System cannot find the path specified.
I am able to run commands using ruby, and rails works if I use GitBash. How do I make it work on my normal command line?
Had the same problem here, installed the same way. Couldn't even run rails commands on GitBash, only way was going in C:\Rails\Ruby2.3.0\binthrough cmd and typing, for example, ruby rails new projectname. The rails new projectnamewouldn't work even in these conditions.
What I did was going in the Command Prompt with Ruby and Rails and entered gem install rails (which did not work on cmd). I also did gem install bundle. Both installed successfully and that fixed all consoles for me: cmd, GitBash (wasn't working for me), Command Prompt with Ruby and Rails and even cmder works with Rails now.
Hope this helps you.
Cheers.
If it's a simple question of locating the rails executable on Windows, then on later installs that use msys64 instead of DevKit, you'll find rails at the following folder:
c:\msys64\o-rdoc
Add this to your PATH or execute from that folder.
Your path may vary on 32-bit systems or if you changed the default install folder.

root:could not open file '/etc/apt/sources.list.d/passenger.list'

When I create a scaffold in terminal, I get the above error message. I have type the following command first:
echo "source \$HOME/.rvm/scripts/rvm" >> ~/.bashrc
I still get the following error:
WARNING:root:could not open file '/etc/apt/sources.list.d/passenger.list'
The program 'rails' is currently not installed. You can install it by typing:
sudo apt install ruby-railties
Any help will be greatly appreciated.
Try running the command source ~/.bashrc and then re-running rails. If that doesn't work, a different approach may be needed.
The problem is that as far as your OS is concerned, Rails doesn't exist. There could be multiple reasons for this. Seeing that you're using rvm, rvm is supposed to tell Ubuntu where to find rails.
Make sure that you are using the correct version of ruby specified in your Gemfile by typing rvm current. Make sure you are using the correct version when running bundle install, otherwise the gems will be installed under a different ruby version.
Also, make sure that the ~/.rvm directory exists and that the path specified in your .bashrc file is correct.
Let me know if any of these suggestions help.

Rails Server is not starting on Windows 10

I am using windows 10. I install Rails and other supporting software via railsinstaller.org website.
Now I go on CMD and writing command rails server but Rails server not starting work. when I open link in firefox http://localhost:3000
Following is snapshot of output when I write rails s in cmd. I have Rails 4.2.5.1 in my PC and using Windows 10
The problem my be caused due to following (Unable to Install gems)
if you are using latest version of ruby installer to install ruby then there are problem for installing nokogiri and ulifier or other gem which needs to compailing in your pc. so you needs to install devkit first. For this please do following:
The download is a self-extracting archive. When you execute the file, it’ll ask you for a destination for the files. Enter a path that has no spaces in it. We recommend something simple, like C:\RubyDevKit\. Click Extract and wait until the process is finished.
Download from here
Next, you need to initialize the DevKit and bind it to your Ruby installation. Open your favorite command line tool and navigate to the folder you extracted the DevKit into.
cd C:\RubyDevKit
Auto-detect Ruby installations and add them to a configuration file for the next step.
ruby dk.rb init
Install the DevKit, binding it to your Ruby installation.
ruby dk.rb install
Now run bundle install
If still problem persist downgrade your ruby or install linux distro.
You need to change your directory to the app root folder.For Example if your app name is 'myapp', then type cd myapp and run rails server with rails s.
Check if the bin/rails file is in place. If not, generate a new sample app, then copy the bin folder to it.
simply add gem "tzinfo-data" to your Gemfile and run bundle install and you are good to goenter image description here

Rails using gitbash and ruby installer. rails command not found

I am trying to get Ruby on Rails going on my Windows 7 machine. I am using gitbash and have install ruby using ruby installer. All my gems have installed successfully (Rails 3.0.7), but when I try to run a command like rails s I get sh.exe": rails: command not found
echo $PATH gives me:
/c/Users/Dave/bin:.:/usr/local/bin:/mingw/bin:/bin:/c/Ruby192/bin:/c/Program Files/Common Files/Microsoft Shared/Windows Live:/c/Program Files/NVIDIA Corporation/PhysX/Common:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/c/Program Files/Common Files/Adobe/AGL:/c/Program Files/QuickTime/QTSystem/:/c/Program Files/Common Files/Microsoft Shared/Windows Live
Since the path for Ruby is in there I am at a bit of a loss for how to be able to start the rails server.
running gem install rails fixed it
This Problem confuses basic developers. Because they simultaneously use both Git Bash & Command Prompt with Ruby and Rails.
When we type "Rails any command" in CMD with Ruby and Rails, we don't see any failure. But if we run the same command in gitbash means, we get the result "Command not found". Running "Gem install rails" fixs it for gitbash users as the above sayings.
For those who use both Git and Cmd with ROR, they can get the command executed anyhow by running on any of the one...

Resources