question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in deployment (digitalocean, nginx)

See original GitHub issue

Hi, 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:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
jtyler258commented, Feb 21, 2019

@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

3reactions
RowanTaubitzcommented, Aug 7, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found