uglifier gem load error / download node.js? - ruby-on-rails

I am getting started with Ruby on Rails, and following the steps at InstallRails... I have created the sample_app on the desktop, and now I cannot create the server.
My command
$ rails server
is answered with the following
...There was an error while trying to load the gem 'uglifier'. etc
I have read several threads here and elsewhere, such as this one and this one... In the latter there seems to bea solution, which I can't understand.... I cannot download node.js! or nodejs? What is my command and directory in Gitbash to download it?

It requires JS runtime.
Just install gem therubyracer for the JS runtime.
In the default rails Gemfile,uncomment the line for the gem 'therubyracer' which is commented out.If you dont find it add the gem to your Gemfile like
gem 'therubyracer'
Then run
bundle install
The gem will be installed and it should work.
Otherwise you can install node.js.
For ubuntu
sudo apt-get install nodejs
For mac
brew install nodejs

Related

Ruby on Rails - sqlite installation problems Windows7

I installed ruby (along with development kit) and then I installed rails using the command gem install rails.
I am looking to start a new rails project, however it is throwing an error, and asking to make sure that
gem install sqlite3 -v '1.4.0' --source 'https://rubygems.org/
succeeds before bundling.
I ran the above command, but I got an error as follows:
I am following these two links to start a rails project or on how to install SQLite in windows.
https://guides.rubyonrails.org/getting_started.html
https://skorks.com/2009/08/installing-and-using-sqlite-with-ruby-on-windows/
I also manually downloaded the sqlite files from the sqlite download page and copied them to C:/ruby/bin folder
Looking for a way to start a new project in rails with no sqlite3 issues.
Add the following line into your project Gemfile and bundle install again.
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
This will fix your problem.

Why doesn't gem install bundler work?

I am trying to deploy an application via Github pages, and based on this tutorial that I am watching, I need to install bundler first.
When I type in the command gem install bundler, I get the error:
While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
I do not have rbenv downloaded and I don't know how to. I also do not fully understand the concept of gems.
How can I bypass this issue?
Try 'sudo gem install bundler'

Can't install ruby on rails in ubuntu gnome 15.10

I am trying to install ruby on rails. I'm at version 2.3.0 for ruby and gem version of 2.5.1.
When I run the command gem install rails I get an error that says:
ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /usr/local/lib/ruby/gems/2.3.0 directory.
How can I fix this?
gem install tries to put files in "system-wide" directories. These are protected, such that only the root user can write into.
You have at least three possibilities:
sudo gem install ..., this will write the gem files into /usr/local/lib/ruby/gems/2.3.0
gem install --user-install, this will install the gem "locally" in your users home directory
apt-get install ruby-rails (not sure about the package name), which will install the ruby on rails version maintained by your distributions maintainers (Canonical).
install and use rvm or rbenv (and there might be other options). Afterwards gem install will usually just work and install the gems for your user only
While the rvm setup might be a tiny bit confusing for newbies, I recommend using that approach. It will make updating and installing ruby, gems and different versions of it really easy.

Rails: uglifier gem won't load

I am getting an error when trying to load server and migrate databases in rails.
My uglifier gem wont load and i need it to run devise properly.
This is the error i get:
There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
I am running windows 8 if that makes a difference.
Do you have nodejs installed? If not, you can run sudo apt-get install nodejs
P.S. you can do node -v to see if you have nodejs installed.

Install Nodejs for V8 Rails to use Less

I tried to install Bootstrap for Rails, but i always got this error:
Please install gem 'therubyracer' to use Less.
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-2.4.0/lib/less/java_sc
ript/v8_context.rb:2:in `require': cannot load such file -- v8 (LoadError)
To avoid this problem i installed nodejs and added this line in config/boot:
ENV['EXECJS_RUNTIME'] = 'Node'
So when i restart my webrich server i see on public indey that the javascript runtime now is nodejs. Then i reapeted the installation of twitter bootstrap but get the same error. I use Rails 4.0 and hope that somebody has an advice for me? Thanks
For Javascript runtime in Rails : Dont use the 'therubyracer' or 'execjs' in your gem files.
First remove those in ur Gemfile and and Remove Gemfile.lock.
After that do this following installation for nodejs.
sudo apt-get install nodejs
I am considering your environment as ubuntu/linux. So for that use above command
And Bundle your app.
Hope this will help you.

Resources