Rspec: command not found

I’m receiving the following error when attempting to run my tests:

Fetching rspec 3.6.0
Installing rspec 3.6.0
...
Bundle complete! 78 Gemfile dependencies, 185 gems now installed.
Bundled gems are installed into `/usr/local/bundle`
...
bundler: command not found: rspec
Install missing gem executables with `bundle install`
Exited with code 127

Clearly rspec is installed, but I don’t seem to be able to access it to run my tests.

I don’t use Bundler, but I’d guess the place it is putting the scripts is not in your system path. Use a fully-qualified path (presumably something of the form /usr/local/bundle/path/to/rspec) to run your command.

I was using
sudo bundle exec rspec ...

Changing to bundle exec rspec ... made rspec discoverable and fixed my problem. No idea why sudo caused that issue but getting rid of it fixed it.

1 Like

It probably resets the PATHs for root and not for the standard user.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.