Ruby on Rails error during installation - ruby-on-rails

I'm trying to install Ruby, I followed the installation guide well, but when I tried to run the server by the command:
ruby bin/rails setup
after I created the controller called blog as described in the instructions, it gave me an error in red and a text in yellow:
Error:
Could not find gem uglifier <>= 1.3.0 in the gems available on the machine.
Yes! I know that this is a Googleable question but all I can get are solutions for people with internet access on their PC.
But unfortunately, my computer doesn't have a working Internet connection. I'm posting this question from my phone. So I'm unable to install uglifier(if that's the required thing to do) through the command prompt. Many thanks.

Please could you check if your Gemfile has the following gem
gem 'uglifier'
If the Gem is not present add it to your Gemfile, if you already have it in your Gemfile please run:
bundle install
After that you should check if the bundler is installing the uglifier gem.
Hope that helps,

Related

Problem when installing rails on windows?

I am trying to create new demo rails program, as guide in my book as this command
rails new demo
then it gave me this error
https://imgur.com/rUSzO4B
It said that my problem is
Could not find gem sqlite3 <> 1.4 x86-mingw32 in any of the gem sources listed in your Gem file
and I must run
bundle install
to solve it
I ran bundle install , but nothing changed.
I know my question maybe too easy to solve, but I am very stuck with this, could you please give me some ideas?
From the documentation of the bootsnap gem in rails: "This gem works on macOS and Linux." See: https://github.com/Shopify/bootsnap
They seem to have found a workaround here:
How can I properly install bootsnap on windows
Add or change to gem 'bootsnap', '=1.4.1', require: false to your project Gemfile

Linux Rails Gem Install Error

Does anyone know what's happening here?
root#ip-172-31-5-114:/home/bitnami/htdocs/kicksharer/kickscraper# gem install rails
Successfully installed rails-5.0.0.1
Parsing documentation for rails-5.0.0.1
Done installing documentation for rails after 0 seconds
1 gem installed
root#ip-172-31-5-114:/home/bitnami/htdocs/kicksharer/kickscraper# bundle show rails-5.0.0.1
Could not find gem 'rails-5.0.0.1'.
Any suggestions for troubleshooting would be really appreciated.
When you gem install rails it installs it on your system. You need to make sure rails is specified in your gem file and then bundle install in order to install those gems in the bundle. (It should use the already installed gems on your system)

Trouble installing nodejs gem

I'm having some trouble installing the nodejs gem. I believe my situation is similar to the question posted here, so I followed the instructions and added gem 'nodejs' to the gemfile, but I'm getting the error
Could not find gem 'nodejs (>= 0) ruby' in the gems available on this machine.
Does anyone know how to resolve this issue?
There is actually no nodejs gem in the RubyGems repository.
The error is just echoing that it can't find a gem with that name.
It's actually just an external binary, that as Blender mentioned, can be installed using the recommendations from nodejs.org.
The gem is called node: gem install node

What is the difference between local and remote gems?

When I tried to install the mysql2 gem (using "sudo gem install mysql2"), I was surprised not to find the gem listed in my "gem list".
After some googling I found out that the mysql2 gem was installed in my remote gems (look them up using "gem query --remote" or with "gem search mysql2 -r") and than I installed them from remote to local using "gem install --remote mysql2".
Now the mysql2 is listed in my gem list.
I am glad I found the solution, however, I don't really understand why the gem installed in remote gems in the first place or what the difference is. Googling did not return a good explanation.
Can someone please explain the difference to me?
Remote gems are really just those on the RubyForge or Github servers. Why it wouldn't install is beyond me, but know that there is no such thing as a remote gem, just gems installed on your machine and gems that you can download from a remote server.

Installing gems tutorial

Is there anywhere that there are step by step instructions on how to install gems?
My google-fu is weak and those that I could find did not resolve my error.
My errors are detailed here:
Getting gcal4ruby gem to work
Basically my error sums up as:
gem installs properly and is detectable by,
but whenever I try to reference it in my application it just says:
Could not find 'gcal4ruby (= 0.0.5, runtime)' in any of the gem sources Try running 'bundle install'.
(* I tried bundle install -> no help *)
Your error states:
Could not find 'gcal4ruby (= 0.0.5, runtime)' in any of the gem sources Try running 'bundle install'.
It's looking for 0.0.5 of gcal4ruby, which you don't have installed, rather you're saying yourself that the gem list -d shows:
gcal4ruby (0.5.5)
Which is not the correct version. I would recommend attempting to discover what's trying to require this older version of gcal4ruby. I think it's in your Gemfile, but I have been known to be wrong occasionally.
If this answer doesn't solve your question, then please attach the errors you're getting and your Gemfile to your question.
As a guess, you are using rails 3? Rails 3 uses a project called bundler for dependencies, so instead of installing the gem in your system ruby, add gem 'gcal4ruby to the Gemfile in the root of your app. after that, a bundle install will install the gem locally into your app.
Bundler means that rails 3 apps have their gems completely isolated from the system gems. Even if the gem is installed in the system, it will not be accessible in the app.

Resources