Nicolas Ferrari
Nicolas Ferrari

Reputation: 61

Deploy NestJS with PM2

I'm trying to deploy my Angular + NestJS application on my Ubuntu server with PM2 and NGINX. I have build my server, that listens to port 3003. Here is the content of the dist folder :

enter image description here

I then used PM2 as follows:

pm2 start ./main.js --name my-backend

If I try to go on my server IP address, on port 3003, e.g. http://99.99.99.99:3003 nothing happen, I get a page that says we can't access the website, with error code ERR_CONNECTION_REFUSED

Do you know what I did wrong ?

EDIT Well I did something wrong because I have the following error : TextEncoder is not defined

enter image description here

Upvotes: 3

Views: 7102

Answers (1)

Nicolas Ferrari
Nicolas Ferrari

Reputation: 61

The issue was that a node module had an error: mongodb-connection-string-url/node_modules/whatwg-url/lib/encoding.js was the problem. I had to edit the file, then use this solution : ReferenceError: TextEncoder is not defined

I think I need to upgrade my NPM and Node on Ubuntu, so that I can have the latest versions, as I'm running node v10 and can go to v14.

Upvotes: 0

Related Questions