Not a great programmer but I ended up adding
require 'rubygems' require 'bundler/setup'
to the start of
solved the issue.