DEV Community

n350071🇯🇵
n350071🇯🇵

Posted on

binstubs is always generated when I run bundle install

What was happened?

I use Spring and When I run bundle install, bundler overwrite my spring binstubs without option --binstub.

Then, I saw the message many many times when I run bin/rails xxx or something. I paste the message at the bottom of this post.

What was the problem?

I develop with Docker and I've found a setting in the file /user/local/bundle/config'.

It's BUNDLE_BIN: "bin". 🥳

(BUNDLE_BIN: Install executables from gems in the bundle to the specified directory. Defaults to false.)

root@b50431918198:/myapp# env | grep bundle
BUNDLE_APP_CONFIG=/usr/local/bundle
GEM_HOME=/usr/local/bundle
BUNDLE_PATH=/usr/local/bundle
PATH=/usr/local/bundle/bin:/usr/local/bundle/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
OLDPWD=/usr/local/bundle
root@b50431918198:/myapp# cat /usr/local/bundle/config
---
BUNDLE_BIN: "bin"

What is the solution?

So, I remove the line from the file.

Additionally

I also added a setting like this.
It runs bundle clean automatically after bundle install

BUNDLE_CLEAN: "clean"

Who helps me?

I'm a Japanese, and we've got a ruby community on Slack.
The name is ruby-jp.
I wish I had an invite URL for you 😭
There is an English channel and some foreigners who can write/read Japanese join in the slack workspace.

I thank him very much!!

Alt Text

The message

Beginning in Rails 4, Rails ships with a `rails` binstub at ./bin/rails that
should be used instead of the Bundler-generated `rails` binstub.

If you are seeing this message, your binstub at ./bin/rails was generated by
Bundler instead of Rails.

You might need to regenerate your `rails` binstub locally and add it to source
control:

 rails app:update:bin           # Bear in mind this generates other binstubs
                                # too that you may or may not want (like yarn)

If you already have Rails binstubs in source control, you might be
inadvertently overwriting them during deployment by using bundle install
with the --binstubs option.

If your application was created prior to Rails 4, here's how to upgrade:

  bundle config --delete bin    # Turn off Bundler's stub generator
  rails app:update:bin          # Use the new Rails executables
  git add bin                   # Add bin/ to source control

You may need to remove bin/ from your .gitignore as well.

When you install a gem whose executable you want to use in your app,
generate it and add it to source control:

  bundle binstubs some-gem-name
  git add bin/new-executable

Top comments (0)