Error in deployment (digitalocean, nginx)
See original GitHub issueHi, I just started with razzle, and created a project with default template. it works fine in my localhost. I deployed it on digitalocean droplet.
I’m getting following error
client.95ca56a2.js:1 Uncaught SyntaxError: Unexpected token < in client.95ca56a2.js:1
Also images are not loading. Any idea?
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top Results From Across the Web
How To Troubleshoot Common Nginx Errors - DigitalOcean
One of the most common errors with Nginx has to do with syntax in your configuration file. Whether it's missing characters or an...
Read more >Debuggin django log on NGINX - DigitalOcean - Stack Overflow
Create your Log directory. mkdir logs in your-app directory. To get your django requests and error log; you'd have to create your indicate ......
Read more >nginx error in Digital Ocean - Google Groups
Have you tried to compile nginx from source and specify the log directory with --http-log-path=/var/log/nginx/access.log ? Etienne.
Read more >Deploy Angular application in NgInx server on DigitalOcean ...
First thing you should do is change default password and provide a very strong password. DigitalOcean recommend setting security and firewalls for new...
Read more >Deploy Ruby On Rails to Ubuntu 22.04 Jammy Jellyfish (2022
You can check and make sure NGINX is running by visiting your server's public IP address in your browser and you should be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@cca313 you’ll need to manually set the RAZZLE_PUBLIC_DIR environment variable to “./build/public” in whatever build environment you’re using. So if you’re using Jenkins you’ll need to configure the variable in the jenkins settings. Or if you’re building inside a docker image you can set it in the dockerfile with ENV RAZZLE_PUBLIC_DIR=./build/public
I had this error too, it has to do with the way the env variables are set when building.
When you do a build, the public path is set from the environment variable ‘RAZZLE_PUBLIC_DIR’.
If you’re building on Windows it inserts the absolute path so when you then move to deploy it’s no longer valid, so express ignores the public path and serves everything requested as the HTML. Thus ‘<’ is an unexpected token in a script file.
I got around this by creating a .env file, adding ‘RAZZLE_PUBLIC_DIR=./build/public’, re-building and then deploying.
I’m not sure if this is as intended.