Can't run Jenkins Build – bundle: “command not found”

I am currently trying to run a jenkins build for some of my cucumber tasks. All of my gems have been installed by using the Bundler. The gems are stored in the vendor folder.

However, when I try and run bundle install --deployment in the execute shell build step, I get the following error:

  • Local override for {gem} at /path/to/local/git/repo is using branch develop but Gemfile specifies develop
  • Ruby “bundle install” error on Openshift
  • How to create interdependent gems with bundler, and use repositories as the source?
  • Failed to push to Heroku. Don't understand what's wrong
  • can bundler install gems from a bare git repo?
  • Bundler, Rails3: how to avoid git check of edge gems in :test group during deploying?
  • Started by user anonymous
    Building in workspace /Users/Shared/Jenkins/Home/jobs/cukes/workspace
    [workspace] $ /bin/sh -xe/var/folders/zz/zyxvpxvq6csfxvn_n0000004000001/T/hudson4461284045505361460.sh
    + bundle install --deployment
    /var/folders/zz/zyxvpxvq6csfxvn_n0000004000001/T/hudson4461284045505361460.sh: line 2: bundle: command not found
    Build step 'Execute shell' marked build as failure
    Finished: FAILURE
    

    This is driving me crazy! It runs on my local machine with no problems. Why can’t Jenkins see my gems?

    Any help would be great!

    Cheers,
    Jon

  • Create jenkins JLNP slave programmatically
  • Git error 401 while accessing it via hudson's git plugin
  • Infrastructure with maven, Jenkins, Nexus
  • How to disable command output in jenkins pipeline build logs
  • MSBuild and Jenkins: where to put credentials?
  • Triggering Jenkins build on both new tags & commits
  • 4 Solutions collect form web for “Can't run Jenkins Build – bundle: “command not found””

    Depending on the way you installed Jenkins, it might be running as a separate user, typically as user jenkins. If you have installed bundle into a nonstandard directory which isn’t in the default PATH, like /usr/local/bin, you need to:

    • Add /usr/local/bin to the PATH of the jenkins user (check ~jenkins/.bashrc) or
    • Configure PATH environment variable in Jenkins global configuration (or slave configuration if building on a slave) or
    • Modify the build script to refer to bundle using a full path name.

    First things to verify:

    • Make sure bundle is installed on the machine where Jenkins runs.
    • If it installed, make sure it’s on the path for the user under which Jenkins runs

    (To verify path/environment: insert shell build step that runs env)

    If bundle is installed in /usr/local/bin/bundle (determine this with which bundle) you could just add a symbolic link to bundle in /usr/bin like so:

    ln -s /usr/local/bin/bundle /usr/bin/bundle

    You could see where is bundle is installed by running which bundle and run the bundle command from there

    Git Baby is a git and github fan, let's start git clone.