Reputation: 14352
I am running the following stack:
on ubuntu running apache
And I am getting the following error:
Could not find json-1.8.1 in any of the sources (Bundler::GemNotFound)
When I look for json as follows:
$ gem list | grep json
json (1.8.1)
multi_json (1.9.2)
It is there but for some reason, the message from Passenger is as follows:
Ruby (Rack) application could not be started
Error message: Could not find json-1.8.1 in any of the sources (Bundler::GemNotFound) Exception class: PhusionPassenger::UnknownError
Upvotes: 5
Views: 8269
Reputation: 41
I ran in the same error when running rails command on mac with yosemite
Executing 'rbenv rehash
' solved it for me
Upvotes: 0
Reputation: 6062
I ran into this exact error while using rack-pow and rvm.
The issue was that pow couldn't find the gems, so using the solution from rvm, I created a .powenv
in the root of the rails app with this content:
# detect `$rvm_path`
if [ -z "${rvm_path:-}" ] && [ -x "${HOME:-}/.rvm/bin/rvm" ]
then rvm_path="${HOME:-}/.rvm"
fi
if [ -z "${rvm_path:-}" ] && [ -x "/usr/local/rvm/bin/rvm" ]
then rvm_path="/usr/local/rvm"
fi
# load environment of current project ruby
if
[ -n "${rvm_path:-}" ] &&
[ -x "${rvm_path:-}/bin/rvm" ] &&
rvm_project_environment=`"${rvm_path:-}/bin/rvm" . do rvm env --path 2>/dev/null` &&
[ -n "${rvm_project_environment:-}" ] &&
[ -s "${rvm_project_environment:-}" ]
then
echo "RVM loading: ${rvm_project_environment:-}"
\. "${rvm_project_environment:-}"
else
echo "RVM project not found at: $PWD"
fi
This solved the problem.
Upvotes: 1
Reputation: 453
I had a shell script I created to run unicorn_rails
for me that spit out this error even if I ran the exact same command manually. I added --login
to the end of hashbang line in the script, and that fixed it.
Upvotes: 0
Reputation: 51
I encountered this a few times in a row when trying to use the rails generate model
command in Mac OS X Yosemite. This problem disappeared after I ran gem update rails
, despite Terminal outputting "Nothing to update".
I'm running Rails 4.1.7 and ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-darwin14.0].
Upvotes: 5
Reputation: 931
For me, this problem was caused by Spring (the Rails quick-loader) not picking up Gem/path changes. I was executing rails generate rspec:install
and getting a json-1.8.1 not found.
I probably executed thirty different commands -- any of which probably had an impact to the final resolution -- but eventually doing a bin/spring stop
allowed further rails
commands to work because they restarted the Spring server with an updated Gem-list.
Upvotes: 5