I was trying to connect rubocop to atom, but received the error:
linter-registry.js [sm]:144 [Linter] Error running RuboCop Error: /usr/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'rubocop' (>= 0.a) among 16 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/home/kurilovichay/.rvm/gems/ruby-2.3.1:/home/kurilovichay/.rvm/gems/ruby-2.3.1#global', execute `gem env` for more information
from /usr/lib/ruby/2.3.0/rubygems/dependency.rb:328:in `to_spec'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
from /usr/local/bin/rubocop:22:in `<main>'
at parseFromStd (/home/kurilovichay/.atom/packages/linter-rubocop/src/index.js:41:43)
at Object.<anonymous> (/home/kurilovichay/.atom/packages/linter-rubocop/src/index.js:212:27)
at next (<anonymous>)
at step (/home/kurilovichay/.atom/packages/linter-rubocop/src/index.js:11:273)
which rubocop returns:
/usr/local/bin/rubocop
can someone assist with that?
It seems that you're using rvm to manage your environment. What i did to get it to work was follow the instructions on their repo: https://github.com/AtomLinter/linter-rubocop#settings
# make sure I'm in the global gemset
$ rvm gemset use global
# install the gem
$ gem install rubocop
configure atom to use the global. Edit your atom's config file (config.cson) and add
*:
"linter-rubocop":
executablePath: "~/.rvm/gems/ruby-2.3.1#global/wrappers"
"linter-ui-default": {}
Note: make sure that the ruby version is the one you're using.
I had this same issue when working on a Rails 6 application in Ubuntu 20.04 with rbenv as my ruby version manager.
I already had rubocop installed in the project, but Atom editor was still throwing this error.
All I had to do was to install the rubocop gem to be available globally on the machine. Open a new terminal and install it using:
gem install rubocop
That's all.
I hope this helps
Related
I have a Rails app. My collaborator updated the app's Ruby version and added Gems. I had to update my local version of Ruby to 2.3.1.
Now it seems that rails s looks for gems in a different location than where bundle install puts them. What do I have to do to get both to put and look for gems in the same place?
Concretely, when I try to start the Rails server with
rails s
I get the message
/Users/Falk/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'railties' (>= 0) among 5 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/Falk/.gem/ruby/2.3.0:/Users/Falk/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0', execute `gem env` for more information
from /Users/Falk/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/dependency.rb:328:in `to_spec'
from /Users/Falk/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
from /usr/local/bin/rails:22:in `<main>'
This happens even though I have already run
bundle install
and all the required gems are included in the gem file. I was able to make progress by manually uninstalling and reinstalling individual gems through
gem uninstall <gem_name>
gem install <gem_name>
but it kept on complaining about one missing gem after another. Then I uninstalled all gems using
for x in `gem list --no-versions`; do gem uninstall $x -a -x -I; done
After that, bundle install still acts as if all gems were already installed. But rails s still does not work and complains about missing gems. What should I do now?
I was able to solve this problem by following the steps outlined here:
bundle uses wrong ruby version
Go to the service/repository that you are trying to run, and go to bin/bundle file. open the file and you will find a code snippet like this :
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')
Change the path to your gemfile as is mentioned here, after which in your service/repository you will find your gemfile. By checking its source provide the right directory path. After which include all your gems into the gem file, like this:
gem 'protobuf'
gem 'grpc'
gem 'protobuf-activerecord'
Finally use
bundle list
to check if the bundler has all the gems initialised in it.
I was trying to install jekyll on my Mac(OS X 10.11.2) to start my blog with a static page, following this instruction (sorry it's written in Korean)
I think I made a mistake when I typed (I typed the wrong URL)
git remote add origin URL
I wanted to delete jekyll and restart from the beginning so I did,
gem uninstall jekyll
and
gem cleanup gems
then the error message showed up like this
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:318:in `to_specs': Could not find 'jekyll' (>= 0) among 26 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/MYNAME/.gem/ruby/2.0.0:/Library/Ruby/Gems/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0', execute `gem env` for more information
from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:327:in `to_spec'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /usr/local/bin/jekyll:22:in `<main>'
I tried installing rbenv with homebrew and every solution I looked up for but nothing has changed.
Is removing all the ruby related files and reinstalling is the only way to solve this problem? If so, how can I do that?
Okay, for your problem only try this:
sudo gem uninstall jekyll
The reason is you have installed this gem into sudo's gemset and tried to remove it from user's gemset. They are different.
I am trying to install bundler using ruby gems and RVM, but I am running into this error when I run the bundle init command:
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'bundler' (>= 0) among 13 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/CalebKleveter/.rvm/gems/ruby-2.2.3:/Users/CalebKleveter/.rvm/gems/ruby-2.2.3#global', execute `gem env` for more information
from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:324:in `to_spec'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /Users/CalebKleveter/.gem/ruby/2.0.0/bin/bundle:22:in `<main>'
I am installing it using this command:
gem install --user-install bundler
I was having issues before when downloading bundler. I was getting this error:
WARNING: You don't have /Users/CalebKleveter/.gem/ruby/2.2.0/bin in your PATH,
gem executables will not run.
So I ran this command to fix it:
PATH=$PATH:/Users/CalebKleveter/.gem/ruby/2.2.0/bin export PATH
Am I installing it in the wrong spot?
All gems were working earlier, but I ran this command:
rvm use 2.2.3
So I am using ruby version 2.2.3, I was using version 2.0.0 before if I remember correctly. Is that the issue?
It's not an issue per se, but you might find incompatibilities between old gems and current version of rails.
Run rvm list and then set the default to the latest version of rails and update your gems.
I upgraded my environment from Ruby 2.0.0 to 2.2.3.
I also upgraded (overwrite) DevKit, and re-run ruby dk.rb install.
I removed Gemfile.lock and ran bundle install to start with a brand new environment. Everything looks ok, but I get the error:
E:\Projects\development\Stairs>rake db:migrate
rake aborted!
LoadError: cannot load such file -- bcrypt_ext
E:/Projects/development/Stairs/config/application.rb:7:in `<top (required)>'
E:/Projects/development/Stairs/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- 2.2/bcrypt_ext
E:/Projects/development/Stairs/config/application.rb:7:in `<top (required)>'
E:/Projects/development/Stairs/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
I first had the same issue with Nokogiri, which I solved using this solution : Nokogiri load error
using Juloi Elixir's solution and installing Nokogiri from a local copy.
But I don't feel like doing this foreach gem! It looks like ruby is searching the gem using a ./ or ./2.2 path, while gems are stored in a ./2.2.0 path. Is this configurable?
How can I solve this issue?
Note: Gemfile contains gem 'bcrypt', '~> 3.1.10'
Thanks!
I spent an entire hour fixing this, just now.
Well what I did was I followed some advice online to do a
gem install bcrypt --platform=ruby
And then, it worked in irb.
irb(main):001:0> require 'bcrypt'
=> true
Later when I had to do a bundle install, for some odd reason rails installed another bcrypt and the error was back. So I had two folders in my gem root.
bcrypt-3.1.10
bcrypt-3.1.10-x64-mingw32
So, since the first folder was the one that got built with the devkit, and it works. I deleted the contents of the second folder and copied the contents of the first into it.
Seems to be working as I'm writing this.
Solution was here: bcrypt-ruby#github:
Rebuild locally the bcrypt gem:
Change to the gem directory \Ruby22-x64\lib\ruby\gems\2.2.0\gems\bcrypt-3.1.10-x64-mingw32\ext\mri>
Run ruby extconf.rb
Run make
Run make install
Note that this works only if your DevKit environment is correctly setup (run devkitvars.bat).
#user1185081 's solution worked for me in a windows machine. I ran following commands and worked like magic:
$ cd C:\RailsInstaller\Ruby2.2.0\lib\ruby\gems\2.2.0\gems\bcrypt-3.1.10-x86-mingw32\ext\mri
$ ruby extconf.rb
$ C:\<DevKit Path>\devkitvars.bat (assuming you have devkit installed)(Ran this instead of running "make" because it was not recognized as an internal or external command)
$ make install
What worked for me on Windows 7:
gem uninstall bcrypt to uninstall all versions of bcrypt, including those listed as dependencies
gem install bcrypt to reinstall
bundle install
In my case, a designating of the old version to bcrypt in Gemfile was a cause of the error. I removed a designating of the version and run bundle update bcrypt, then it was settled.
Here is the solution worked for me:
C:\> gem uninstall brcypt
C:\> gem install --no-ri --no-rdoc bcrypt
C:\> cd (path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri
C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> ruby extconf.rb
C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> make
C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> make install
I had the same problem:
cannot load such file — bcrypt_ext
Windows 8.1 64bit
ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
Rails 5.1.4
My solution:
gem uninstall bcrypt-ruby
gem uninstall bcrypt
gem install bcrypt –platform=ruby
added this whole line to Gemfile:
gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
bundle install
This works for me, add this to your gems file:
gem 'bcrypt', '~> 3.1.7', platform: :ruby
This process is for windows:
The problem is with the programs installed on the system.
Uninstall all rails programs:
All Ruby programs.
RailsInstaller.
Removes all files that have been able to uninstall, you have to do it manually inside:
C:\RailsInstaller
Install de ruby version 2.2 from:
http://railsinstaller.org/en
Wait a moment and it's already to go.
MarlonJon.es
I've cloned diaspora for github, git://github.com/diaspora/diaspora.git
I tried to install it. An error generated when I use bundle install.
$ bundle install
/usr/local/lib/site_ruby/1.8/rubygems.rb:812:in `report_activate_error': Could not find RubyGem bundler (>= 0) (Gem::LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems.rb:223:in `activate'
from /usr/local/lib/site_ruby/1.8/rubygems.rb:1146:in `gem'
from /usr/bin/bundle:18
I'm using rails 3 and ruby 1.8 on ubuntu 11.04. How to fix it? Please help
Did you install bundler gem?
$ gem install bundler
You might need sudo privileges.
Hmm, maybe you've got the bundle command and bundler gem installed for /usr/bin/ruby, and after that installed another Ruby in /usr/local/bin/ruby?
Could you do a which ruby and head -1 /usr/bin/bundle? Maybe also a gem list?
Presumably this has been fixed long ago, but for the benefit of others....
My issues was that while I had installed the bundler gem it had been installed in a different location to the current GEM_PATH - so it couldn't be found.
So,
GEM_PATH=/usr/lib/ruby/gems/1.8/ bundle install
did the business, setting the value of GEM_PATH to the actual location of the gems folder where the bundler gem has been installed.