Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running rails in production mode locally

I am trying to run rails(dont know much about it) in production mode using the following command:

rails server -e production

But I am getting these errors in console and an ugly page without the css is getting loaded:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://10.20.200.199:3000/".
(index):1 Refused to execute script from 'http://10.20.200.199:3000/javascripts/application.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
(index):1 Refused to execute script from 'http://10.20.200.199:3000/logins/plugins.js?v=1' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

This is happening in all the scripts we are using.

Can somebody help me what might be going wrong here.

Thanks in advance.

like image 763
Kop4lyf Avatar asked Sep 26 '22 07:09

Kop4lyf


1 Answers

For running with production environment prebuild assests: rake assets:precompile

The described errors suggest that the browser requests static assets; these aren't built (they aren't built automatically in production - you are expected to build them on each deploy), so nothing is found at their URLs and error page is rendered instead. Thus the browser errors saying that the downloaded css and javascript files have wront MIME types.

like image 194
igneus Avatar answered Sep 28 '22 06:09

igneus