Reputation: 25237
I have been following this tutorial to deploy Phusion Passenger with Nginx, and after finishing, I still get an error when I open the URL with the IP address (http://123.123.123.123)
When I watch the error.log from nginx, I see this:
http://pastie.org/pastes/10358955/text?key=s16vrhu2cofrian1hluwa
From that log, i noticed this:
Warning: compilation didn't succeed. To learn why, read this file: App 15789 stderr: /tmp/passenger_native_support-1g8vwu3.log
So this is the output of that file:
http://pastie.org/pastes/10358951/text
What is the problem here? Why is my rails app not working?
Upvotes: 1
Views: 533
Reputation: 18924
Actually, the problem is not so much the lack of a Javascript runtime. While the error message does mention "Could not find a JavaScript runtime", the actual problem is that your PATH environment variable isn't set correctly.
The indicator is in these two seemingly unimportant error messages:
App 15789 stderr: sh: 1:
App 15789 stderr: env: not found
env
is a common Unix command, located in /usr/bin. Node.js, as well as pretty much everything else, is also located in /usr/bin. If the system cannot find env
then that means your PATH environment variable isn't set correctly.
The reason why it isn't set correctly, is most likely because Nginx nuked your environment variables. Try adding this to your Nginx config file:
# Don't nuke PATH; preserve original value.
env PATH;
Upvotes: 6
Reputation: 10406
You need to install a javascript runtime. Simplest solution is to add therubyracer to your Gemfile.
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
It also seems you need to install either curl or wget based on the log.
Upvotes: 0