Hi I have installed passenger modul for apache2 and then i tried to install rails, with the command:
gem install rails
It seemed to be done well. But when I check the verison now with
rails --version
i got an error during this:
command not found....
You need to specify the PATH variable to folder where you have installed Rails, so when the 'rails' command will be triggered your system will know which program to launch.
Example: PATH=$PATH:/your_rails_folder
Related
I just started in Ruby, so after a lookup on internet I installed it using rvm. The version of ruby is 2.6.3. This is the output for ruby -v:
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
I also installed Rails using gem install rails and get the version 6.0.2.1.
After that I created a project called blog using rails new blog, the project was created and in the directory I run bundle install and get the following error message:
There was an error while trying to write to
`/home/ramon/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/versions`.
It is likely that you need to grant write permissions for that path.
After that I run sudo bundle install and get this error:
Your Ruby version is 2.7.0, but your Gemfile specified 2.6.3
But my Ruby version is already 2.6.3.
After searching for answers on internet I tried these solutions:
sudo gem update bundler
sudo gem install bundler
sudo gem install rails
But all of this returned the same error:
/usr/bin/env: ‘ruby’: No such file or directory
Then I run which ruby and got this: /home/ramon/.rvm/rubies/ruby-2.7.0/bin/ruby
and added this line do .bashrc:
export PATH=$PATH:/home/ramon/.rvm/rubies/ruby-2.7.0/bin/ruby
But still got the error.
I tried changing this line in /etc/login.defs to:
ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/$
And /etc/environment to:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/$
But I dont know what to do anymore, tried every solution on internet and nothing works.
One thing I tried was running which ruby as superuser, and I got nothing.
Maybe it is a PATH problem or a permission problem. But I dont know anymore what to do.
I use lubuntu 19.04.
I think you have two versions of Ruby , so you may try this:
rvm --default use [correct version number]
Create a new file .ruby-version in the main folder of project and put ruby version inside:
2.6.3
or
2.7.0
because I don't know which Ruby version you want do use.
Save and go to the console and do this:
cd ..
cd blog (your project name)
I have just set up ruby and rails on a freshly installed freeBSD. It works great. I can do rails new blabla mv into blabla and do rails s and it just works.
I had an up and running rails app on another computer. I copied the repertory that contained the app to the new computer running freeBSD. However, when I mv into that repertory of the rails app and to rails server I get -bash: rails: command not found
I have tried creating a new app with the same name and let rails create all the repertories and then copy the files of the existing rails app therein but no success.
I can run rails -v and rails s from within any repertory and get correct answer, but when I move into that specific repertory I get that command not found.
You're probably using a ruby version manager I suspect (rbenv/rvm)? Check the ruby version in your Gemfile (top of the file). It probably isn't the same as the ruby version you have installed. If you're using one of the above mentioned version managers than install the correct ruby for your rails project. After that you can do a gem install bundler in the project directory and after run bundle install which will install rails and all dependencies.
Which version you are using? It happens with earlier versions. Try updating your gems and bundler. And try again. Hope it helps.
Did you try running bin/rails s? I think tha you need run bundle install too.
Running OSX Mavericks, ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0], rvm 1.25.23 (master), and rails-4.1.0 (allegedly)
I'm working through the railsapps.org book on learning rails and made it about 1/2 way through yesterday. When I stopped for the day, I closed out iTerm2 and shut off the Macbook Pro. Today, I powered up, opened iTerm, navigated to my working directory (~/rubyonrails/learn-ruby) and entered rails -v.
I see this:
`Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.`
So I run sudo gem install rails and it shows that it has installed rails-4.1.0. Now rails -v still gives me the same error message above.
I tried also running rvm use ruby-2.1.1#learn-rails first and I still get the error message.
So I'm a little stuck and I can't figure out what to do to get rails working. Also, how do I go about setting up the bash environment such that I don't have to go through this each time? It would be nice to nav to my working directory and just start work without having to do a bunch of re-installation and reconfiguration each time.
Regards,
Jeff
please type in your shell:
$ bash --login
and then repeat your commands.
rails -v
Also try to call it with the full path:
like:
/your/path/to/rails -v
I think that the shell just doesn't know where rvm/rails etc is located.
You can solve this by entering:
$ source ~/.rvm/scripts/rvm
When you switch to the ruby-2.1.1#learn-rails ruby/gemset combo, and do gem list, what do you see?
The way people usually use rvm is to have every project folder specify the ruby & gemset it uses (they don't all have to be different). This is done with files called .ruby-version and .ruby-gemset. These should contain, in your case, ruby-2.1.1 and learn-rails respectively.
Set these if you haven't already, then leave the folder and enter it again. Then do bundle install to install the gems for the project into the rvm/gemset combo.
Your problem is that you ran
sudo gem install rails
The error message telling you to do this comes from your system Ruby, which doesn't know that you want to use RVM.
RVM installs gems into your user-space directory. By using sudo, you're bypassing this and installing it into (effectively) the superuser space, i.e. globally.
If you instead just run
gem install rails
then you'll be using RVM's copy of the gem utility rather than the globally installed version.
I just ran an Update on my Snow Leopard and today when I tried to run Rails server I got the following:
Rails is not currently installed on this system. To get the latest
version, simply type:
$ sudo gem install rails
On Echo $PATH I get following:
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
Update
Running the command giving above for installing rails did not do any harm. I guess updating process removed previous links of rails. the latest version of Rails and dependencies got installed and things working perfect
Try this command
which rails
and see if rails is installed. If it is, add it to your executable path
I am trying to install LESS in a Ruby on Rails project. I am able to run the gem successfully, but when I try to install the plugin for LESS, I get an error. Here's what shows in the terminal:
MacBook:benji jesse$ sudo gem install less
Successfully installed less-1.2.21
1 gem installed
Installing ri documentation for less-1.2.21...
Installing RDoc documentation for less-1.2.21...
MacBook:benji jesse$ sudo script/plugin install git://github.com/cloudhead/more.git
sudo: script/plugin: command not found
I am a .NET developer trying to learn Ruby on Rails (on a Mac), so I am new to all this stuff.
My question's are:
Is the script/plugin command a standard command?
What does it do?
Where can I learn more about this command?
Why does it say command
can't be found?
Is the script/plugin command a standard command?
It is in rails 2, it has changed in rails 3:
rails plugin
# or
script/rails plugin
What does it do?
installs the given plugin into the RAILS_ROOT/vendor/plugin, but you should look if there is a gem version of the plugin, than you can add a gem dependency to this gem.
Where can I learn more about this command?
run the command without any parameters
Why does it say command can't be found?
try ls script/ and see if the file exists.
You have to be in the application directory. Say you created your rails app in the folder development/rails_app. You must execute the script/plugin command from there (and you don't need super user permissions for that):
cd development/rails_app
script/plugin install git://github.com/cloudhead/more.git
The plugin installation will apply only to the current rails application (in this case, rails_app). So if you create another application, you must run the script/plugin command again.