noloman
noloman

Reputation: 11975

Ruby: bundle not working with rbenv (path name contains null byte (ArgumentError)

I have created a RubyGem and today, I was going to update the dependencies, but now after I go to the gem's directory and type bundle install I get this error, whose last line is:

/Users/myuser/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems/specification.rb:2663:in `directory?': path name contains null byte (ArgumentError)

I have reinstalled bundler, updated the system gem, etc., but nothing seems to be working. How can I avoid this?

Thanks a lot in advance!

Upvotes: 3

Views: 1132

Answers (2)

csoria
csoria

Reputation: 753

Check your gemspec file, in my case I replaced by mistake the double quotes with single quotes around the null character.

-    `git ls-files -z`.split('\x0').reject { |f| f.match(%r{^(test|spec|features)/}) }
+    `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }

Upvotes: 9

lacostenycoder
lacostenycoder

Reputation: 11216

Go to the root of your project and run these commands

rbenv global 2.6.2
gem install bundler
rbenv rehash
bundle install

Upvotes: 0

Related Questions