just recently installed ruby 2.3.0 and rails 4.2
ran bundle install for the first time and my app successfully ran from my local server.
added a few gems, and once again ran bundle install... it appears that my previously installed gems were once again being installed.
tried running rails server once again and this came out.
-bash: /usr/local/bin/rails: /usr/bin/ruby1.9.1: bad interpreter: No such file or directory
just making a wild guess here, but i think the gem folder is reverting back to my old folder which is ruby 1.9.1
any form of help would be greatly appreciated.
You can read about different ways to set the app/project environment at rvm project workflows
if you are using rvm to manage the rubies, just add this line at the top of your gem file..
ruby '2.3.0' #or the target version of the app
or
#ruby=2.3.0
and cd back into the directory.. you'll get a warning but just ignore it. now every time you change back to you app directory it'll change the version to the one mentioned in your gem file. the default might be set to some other version..
you can also use
bash --login
rvm use '2.3.0' --default
to set the default version of ruby system wide.
if that doesn't work.. try to check if the correct ruby version is present by
rvm list
and then try using it by
bash --login
rvm use '2.3.0' #or the target version
and to every time switch to the latest version don't do anything above except when installing the version set it to default.. but you'll have to install all the gems again for every binary ruby you install..
P.S. Fixing ruby version for a project/app is a good and safe practice, so I'd recommend you to use the any approach to fix a ruby version for the app, mentioning it in Gemfile is clean, makes sense to me when you only need to set the ruby version.
Note. Do whatever is in #Shrikant1712's answer first if you haven't already or you might run into issues.
You have need to install gem bundler using gem install bundler command and then again try to use bundle install command.
(Here I am assuming you have used RVM for installing ruby.)
Still you get same type of error then that means your rvm is not properly set. Please check your $PATH from the following files
~/.profile
~/.bashrc
~/.bash_profile
~/.gemrc
You can use source ~/.rvm/scripts/rvm for setting the rvm.
Related
I am pretty new to ruby and rails development, And I am working on linux subsystem for windows. I have been getting the above mentioned error. Here's what all I have done:
reinstalled rvm
added export PATH="$PATH:/usr/bin:/usr/local/bin/:/usr/share/rvm/bin:/usr/share/rvm/rubies/ruby-2.5.1/bin" the path in .zshrc file
but the problem is still persisting. another thing I know is rvm is installed in /usr/share/ directory
I have also referred this link:
problem with bundle
Any help would be greatly appreciated!!
I can suggest you to run which bundle command. The path it returns contains a ruby version. I'm almost sure that you won't have this ruby version on your local machine. Check that by running rvm list. To solve the problem try either installing the version of ruby or reinstalling bundler using sudo and gem- sudo gem uninstall bundler - > sudo gem install bundler.
NOTE: your ruby version has to be the same with the one in the Gemfile.
I want to free up disk space in my production environment taken up by gems installed for old ruby versions. I don't believe bundle clean will work in this instance, because I don't think it cleans out the old gems for other rubies.
These gems are installed via capistrano and are installed in a custom location, rather than system wide. In my /path/to/my-project/shared/bundle/ruby dir, I see 2 subdirs - 2.2.0 & 2.3.0. Since I am now using ruby 2.3, is it safe just to delete the 2.2.0 directory? Is there anything else I need to do?
Use "sudo gem cleanup" to remove all previously installed gems which respecting all the dependencies be it on old version of ruby. You can see all the gems that ll be removed with command "sudo gem cleanup -d"
here is how you can remove a specific version of the gem:
gem uninstall (gem name here) --version (version number here)
Go to Gemfile.lock and delete all its content. Then you go to Gemfile and delete gems you do not want anymore. After, You type bundle install and it will install just the ones you want.
I have been using Ruby on Rails with postgresql and something suggested that I should install RVM which I did (I think it was to utilise Phonegap). Since I put RVM in place I have been unable to execute bundle install which in turn means that I can no longer run other rails commands.
Lots of reading hasn't really given me an answer but I have lots of ideas. Maybe someone can help focus those ideas into a solution?
When I run bundle install there are 3 gems that seem to be causing the problem, but I think they are interlinked. They are byebug 8.2.2 and pg 0.18.4 and binding_of caller 0.7.2
The contents of byebug-8.2.2/gem_make_out are as follows:
/home/damo/.rvm/rubies/jruby-9.0.5.0/bin/jruby -r ./siteconf20160927-16151-j7mhkf.rb extconf.rb
NotImplementedError: C extensions are not supported
<top> at /home/damo/.rvm/rubies/jruby-9.0.5.0/lib/ruby/stdlib/mkmf.rb:1
require at org/jruby/RubyKernel.java:937
(root) at /home/damo/.rvm/rubies/jruby-9.0.5.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
<top> at extconf.rb:6
extconf failed, exit code 1
When I look at byebug issues it simply says that byebug doesn't support jruby.
I did not have any issues before I installed RVM and I'm sure I read that byebug was hardwired into Rails 4. I wanted to tell you my Rails version but rails -v gives me a response of
Could not find proper version of railties (4.2.5) in any of the sources
Run `bundle install` to install missing gems.
Which seems to be my Catch 22!
This kinda sounds like you're not using RVM in a login shell. In Bash you can run bash -l, then source ~/.bashrc (or whatever contains your rvm invocation lines). After that, try rvm use ruby-2.2 (or whatever), and if you don't get "RVM is not a function" error, then you should be good to go.
Note that under RVM you'll probably have to do gem install bundler manually for each distinct ruby version (and gemset), because ruby (and gemsets) under RVM live in their own worlds, and system bundler tends to be old. If you're reusing ruby installations and either not using or sharing gemsets, bundler may already be up to date.
So: use a login shell, do rvm use <your_favorite_ruby_version>, install bundler if necessary, then bundle install.
Last but not least, I like to use .ruby-version files so I don't have to switch rubies and gemsets manually, and I can tell if everything's working from the output of rvm info.
Where you using jruby before you installed rvm? Seems like your default ruby changed to jruby as opposed to whatever you where using before (system ruby?).
Try running
rvm use system
in the root of your rails project then try the bundle install and see if that fixes it. If it does then then can use setup .ruby-version files to control which version of ruby you use per project.
Or else type
rvm use system --default
to set your default ruby back to the system one and continue like you where preciously.
I'm currently working on a project which was changed from ruby version 2.0.0 to ruby verion 2.1.1,
i'm using rvm for maintaining my ruby versions. After installing ruby 2.1.1, I ran gem install bundler which installed version 1.6.2, doing so I had copied a specific gemset version to a newly created one for version 2.1.1 after which when running gem list on, it displayed all the gems, and when I tried to run the app it started throwing errors.
So when I ran bundle install again it created a separate folder parallel and installed the gems there. My question is why does this happen, is it a new feature of bundler 1.6.2'?
Initially I had my bundler version to 1.5.2.
Any input on this will be really helpful.
Thanks.
Found this post which explains clearly, the reason was my config file was corrupted.
we have to remove .bundle/config file and bundle install again.
rm -r .bundle/config
bundle install
click here for more information.
Thanks.
My guess is you have two different bundlers tied to a different RVM gemset, even if you tried to install the newest globally.
In the future you may consider using :
bundle install --path .bundle
to install your gems in a consistent manner, always in the same .bundle folder, no matter what RVM gemset you're using.
This has driven me crazy. I changed laptop and tried getting my Rails environment working again. Mac OS X has its own ruby, but I used brew and installed new. I installed rails 3.0.5, ran:
bundle install
Then:
rails s
I got this error:
Could not find aws-s3-0.6.2 in any of the sources
Run `bundle install` to install missing gems.
After bashing my head against a wall for a couple hours, I tried just manually installing the gems and it worked! So, apparently, rails and bundler are looking at different places for my gems. Both are from my brew install.
How can I figure out what each is looking at so I can use "bundle install" again?
Rails and Bundle are looking at the gems providing they are in the bundle.
Use the
bundle show
command to see the gems Rails is having access to via bundler.
Also you can examine the Gemfile.lock file.
The gemfile sources mainly from rubygems.org as supposed to rubyforge (which came up when i searched that gem on google). I think the gem command will check both. You can specify additional sources, as mentioned in the readme: http://gembundler.com/man/gemfile.5.html
Are you using pow? I've been having this issue with Pow starting up with one version of ruby, but not the version that I have RVM currently set to.
I have not tried it yet, but this issue on Github mentions the problem and refers people to the Pow trouble shooting here. I've pasted the contents below:
RVM
Incorrect ruby or gemset is being used
Create a .rvmrc at your project root. See rvmrc docs.
System-wide RVM install
If you have a system-wide RVM install and are getting the error LoadError: no such file to load -- bundler/setup, run rvm info to find out where rvm is installed on your machine, then do this:
echo "export POW_RVM_PATH=/usr/local/rvm/scripts/rvm" >> ~/.powconfig
Where /usr/local/rvm/ is the location of your rvm installation.
Then restart POW by killing it in the Activity Monitor or in Terminal.