Node app runs locally, but not on DO

February 13, 2018 356 views
Node.js Ubuntu 16.04

Hi

I've created an eCommerce app with Nuxt.js, and therefore Node.js. It is hosted on DO, and actually it works, but whenever I make changes to the code, and build the app again, and then try to click around in the app live, it crashes and waits forever. If I empty cache and cookies it works again. This is not ideal, since it's a live eCommerce app.

The reason I think it's a DigitalOcean related issue is that it's working locally, but not on DigitalOcean Droplet.

What's going on, and how do I fix this? :)

1 Answer

This is strange behavior. To be able to debug the problem, we'll need little bit more details.
How do you run your (Node.js) application? Have you checked logs to find out the root of the problem?

Also, did you tested with another browser? Lastly, if you're using some caching solution or CDN, make sure it's configured correctly.

  • Thank you for answering my question.

    I'm not sure of where to check logs? There's no logs from the app in console for example, and also there's nothing to be seen in /var/log. Also there's no errors in /home/sebastian/.pm2/logs.

    I run my application like this: yarn build, and then pm2 start build/main.js --watch. And then, whenever I try to make a change to the app, and run yarn build again, and pm2 restart main it is crashing, and I have to empty cache and cookies.

    I've tried Chrome, Safari and Edge. Surprisingly the issue doesn't seem to occur in Edge, but the other two browsers crash.

Have another answer? Share your knowledge.