Rails won't install - ruby-on-rails

To start I'm pretty new at rails which I'm sure this question will show. I was about to follow the steps on gorails.com to setup a local server. I also use codeanywhere for when I have internet access. When I try to install (rails new myapp) rails I keep getting the following error from my terminal command
extconf failed, exit code 1
Gem files will remain installed in
/var/folders/0d/yx9wdh954jjbn_pnn5nbm5540000gn/T/bundler20190310-64475-5t7xkksqlite3-1.4.0/gems/sqlite3-1.4.0
for inspection.
Results logged to
/var/folders/0d/yx9wdh954jjbn_pnn5nbm5540000gn/T/bundler20190310-64475-5t7xkksqlite3-1.4.0/extensions/universal-darwin-17/2.3.0/sqlite3-1.4.0/gem_make.out
An error occurred while installing sqlite3 (1.4.0), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.4.0' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
sqlite3
run bundle exec spring binstub --all
Could not find gem 'uglifier (>= 1.3.0)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems."
Any Help on the matter would be greatly appreciated. Thanks in advance.

Please edit the file in your ruby rails project named Gemfile and change following
gem 'sqlite3'
to
gem 'sqlite3', '~> 1.3.11'
Now run following command to install Gem
bundle install
now run your rails project
rails s

I think you are missing sqlite3.
Run the command
sudo apt-get install -y sqlite3 libsqlite3-dev
Then modify gemfile to
gem 'sqlite3', '~> 1.3.11'
Then run
bundle install
In rails some packages needs to be installed in your local ,after which they can be included in your gemfile. The same applies for mysql and psql.

Related

gem install and bundle install fails to install sqlite3

I'm new to Rails, and I'm learning it from The Ruby on Rails Tutorial.
The bundle install command shows this error when I use gem 'sqlite3' in Gemfile;
An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.2' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
sqlite3
I found a solution to this over here - https://medium.com/#declancronje/installing-and-troubleshooting-ruby-on-rails-sqlite3-windows-10-fix-87c8886d03b, that suggested that gem 'sqlite3' should be replaced with gem ‘sqlite3’, git: “https://github.com/larskanis/sqlite3-ruby", branch: “add-gemspec”. On running bundle install after upating Gemfile, all the required gems, including sqlite3, appear to have installed;
Bundle complete! 15 Gemfile dependencies, 70 gems now installed.
Use 'bundle info [gemname]' to see where a bundled gem is installed.
But on running the command sqlite3 --version, I still get the error message that says
'sqlite3' is not recognized as an internal or external command,
operable program or batch file.
I have also referred to various stackoverflow answers, but none of them seem to work. gem install sqlite3 is also not working.
Please help.
try it helped
sudo apt-get install libsqlite3-dev

Running bundle install with modifier on certain gem

I'm trying to work on a project that uses the mysql2 gem, version 0.3.17 specifically.
I can get this to install by running:
gem install mysql2 -- --with-mysql-dir=C:\mysql\connector -v '0.3.17'
However after doing this (in the projects directory), and then run bundle install, it fails with the message
An error occurred while installing mysql2 (0.3.17), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.17'` succeeds before bundling.
Is there any way to run something like
bundle install -- --with-mysql-dir=C:\mysql\connector -v '0.3.17'
? I'm guessing I would need to specifiy the mysql2 gem in the command but I've looked on http://bundler.io/v1.3/man/bundle-install.1.html and can't seem to find anything.
My other option would be to simply point it to the gem I've already installed if that's possible.
Thanks in advance.

I git cloned a repo and I cannot run it on localhost because missing gem and cannot bundle install

I git cloned a repo. I cannot run it on localhost with rails server because terminal says
Could not find activesupport-4.2.5 in any of the sources Run bundle
install to install missing gems.
When I run bundle install, I get
An error occurred while installing pg (0.18.4), and Bundler cannot
continue. Make sure that gem install pg -v '0.18.4' succeeds before
bundling.
I have rails 4.2.3, and the repo's Gemfile has gem 'rails', '4.2.5'. I don't know if this matter
Gem pg is Postgres driver, it only can be installed, if corresponding headers and libraries are present and can be accessed.
Most probably just installing postgres will fix it. If you're on a Mac with homebrew - brew install postgresql
Install postgresql.
Remove Gemfile.lock
Add gem 'pg' in your gemfile
execute bundle install
1: Remove Gemfile.lock if Gemgile.lock present in your project
2: add gem 'pg' # in Gemfile
3: Run bundle install
Hope this help you !!!
Run
sudo env ARCHFLAGS="-arch x86_64" gem install pg -v '1.18.4'
Now try running bundle install again.
I used a combination of #Chakreshwar Sharma and #Vinay's answers to get this working for the metasploit-framework.
Remove Gemfile.lock
Add gem 'pg' in your gemfile
Run apt-cache search postgresql-server-dev
apt-get update && apt-get install postgresql-server-dev-9.5 # Check your version
bundle install --no-deployment
To be honest, I think you could just run:
apt-cache search postgresql-server-dev
apt-cache search postgresql-server-dev-9.5
bundle install
...and you can avoid messing with the Gemfile, but I didn't get to verify it since mine started working after I made the adjustments.

MySQL gem install error on Windows 7

I am using Windows 7 and creating connection to MySQL2. I need to install gem. I am following these steps. Could someone please review them:
Add the following to the Gemfile: gem 'mysql2', '~> 0.3.15'
Run the following in cmd: gem install mysql2 -v '0.3.15'
Go to the application using cmd and run this code: bundle install
When I perform step (3), I get the following error:
An error occurred while installing mysql2 (0.3.15), and bundler cannot
continue make sure that `gem install mysql2 -v "0.3.15" ' succeeds
before bundling..
My application resides on the D drive and I am using Windows 7.
I have found a solution that works on Ubuntu.
My mistake was that had not installed the my-sql library before trying to connect.
Please follow these steps to do this. Run the following commands:
sudo apt-get install mysql-client libmysqlclient-dev
sudo gem install mysql2
Add the following to the gemfile
gem 'mysql2', '~> 0.3.15'
And then run:
bundle install

How to put metadata in sqlite3-1.3.4-x86-mingw32.gem

I perform bundle install but it cannot continue because of sqlite3 it always returns to:
Gem::Package::FormatError: no metadata found in C:/RailsInstaller/Ruby1.9.3/lib/
ruby/gems/1.9.1/cache/sqlite3-1.3.4-x86-mingw32.gem
An error occured while installing sqlite3 (1.3.4), and Bundler cannot continue.
Make sure that gem install sqlite3 -v '1.3.4' succeeds before bundling.
How will I resolve this issue?
simply run gem install sqlite3 -v '1.3.4' this should fix the issue. Its because the gem is not included it the list of dependencies so running the command will fix it up

Resources