I've been trying to run a bundle install and I always seem to get the same error 'Could not locate Gemfile or .bundle/ directory'
If someone could explain a possibility of why I may be getting this it would be very helpful
Thanks :)
To confirm which file bundler is trying to use as its Gemfile, try this:
bundle exec ruby -e "puts ENV['BUNDLE_GEMFILE']"
To make sure you don't have a setting that's causing bundler not to use the Gemfile in your current (or a parent) directory, try this:
bundle config Gemfile
Related
I get this error Could not find command "add" when I try to run something like bundle add bcrypt_pbkdf --version "<2.0,>=1.0"
I cannot find anything like this online. I tried bundle install, bundle update, gem install bundler, etc, but it didn't work
How do I fix it?
bundle doesn't have a subcommando for adding new gems. To add a new one, open the Gemfile and manually add your new gem into it. Like:
gem bcrypt_pbkdfm, "~> 1.1"
After that, run:
bundle install
It will read your Gemfile, will download the gems and create a new Gemfile.lock with the installed version.
To understand more about the specs of Gemfile visit https://bundler.io/gemfile.html
EDIT
In fact bundle has bundle add command. I've never used, but it seems to achive the same goal as the manual insert.
I am using IntelliJ IDEA to develop a Ruby gem.
To run the gem from the command line without installing it first I am using:
bundle exec my_gem
This works fine.
I can also create a Gem Command run configuration within IntelliJ IDEA and that works.
What I actually want to do is to run this gem in another directory.
Using bundler:
bundle exec --gemfile /path/to/my_gem my_gem
However from IntelliJ IDEA can't get this to work as there is no way to specify the path to the Gemfile. It fails saying:
Could not locate Gemfile or .bundle/ directory
Anyone know a solution to this?
$ sudo ./msfconsole
Could not find rake-10.1.0 in any of the sources
Run `bundle install` to install missing gems.
$ rake --version
rake, version 10.1.0
Does anyone know what could cause this?
I tried running bundle install, but when I try to run msfconsole again afterwards it throws the error again.
It might be a PATH-related issue.
Try it with sudo -E, so that your PATH, gem locations, etc. all become available when running sudo.
Other possibilities might be detailed in these related questions:
Could not find rake with bundle exec
bundle exec fails with "could not find rake-10.1.0 in any of the sources"
Could not find rake-10.1.0 in any of the sources
I'm using Ubuntu. I tried installing bundler via 'gem install bundler', and it seems to have worked. In terminal, if I type 'gem list', I see bundler 1.3.5 in the list. However, if I run 'bundle install', I get the error 'Bundler::GemfileNotFound'... I'm not sure why
It's likely the bundle binary is not in your path.
You can check this by executing the following:
echo $PATH
which bundle
If your bundle path is: /Users/xxx/.rbenv/shims/bundle
Your PATH needs to include: /Users/xxx/.rbenv/shims
https://askubuntu.com/questions/60218/how-to-add-a-directory-to-my-path
Bundler is looking for a file called Gemfile in your current directory. The error means that it isn't there. Are you sure you're in the right directory?
I just installed Ruby 1.9.3 on Windows 7 and I also installed rubygems. I'm trying to work with rspec so I ran:
gem install rspec
It seemed to work well and everything installed. SO I went on to try the example on this page. But anytime I run the rspec command I get this error message:
"Could not locate Gemfile".
According to the example, I should get: "./bowling_spec.rb:4:
uninitialized constant Bowling"
I've googled it and it was suggested I try bundle exec rspec but it still yielded the same results.
I have also tried the suggestion on this page but it yields the same results. What am I doing wrong? Thanks
Create the Gemfile with this content. Gemfile can have no extension or .gem extension
source 'https://rubygems.org'
gem 'rspec'
so you have
app/
Gemfile or Gemfile.gem
spec/
bowling_spec.rb
Also you might need to execute this commands after
gem install bundler
and then, in the app directory
bundle install
gem install rspec in the same directory as your app and
change require statement to require './bowling.rb'