0

I tried to start a project

node index.js , I got this

events.js:173 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE: address already in use :::3000 at Server.setupListenHandle [as _listen2] (net.js:1255:14) at listenInCluster (net.js:1303:12) at Server.listen (net.js:1391:7) at Function.listen (/home/forge/bheng/public/ios-base-api/node_modules/express/lib/application.js:618:24) at Object.<anonymous> (/home/forge/bheng/public/ios-base-api/index.js:156:5) at Module._compile (internal/modules/cjs/loader.js:721:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10) at Module.load (internal/modules/cjs/loader.js:620:32) at tryModuleLoad (internal/modules/cjs/loader.js:560:12) at Function.Module._load (internal/modules/cjs/loader.js:552:3) Emitted 'error' event at: at emitErrorNT (net.js:1282:8) at internalTickCallback (internal/process/next_tick.js:72:19) at process._tickCallback (internal/process/next_tick.js:47:5) at Function.Module.runMain (internal/modules/cjs/loader.js:777:11) at executeUserCode (internal/bootstrap/node.js:342:17) at startExecution (internal/bootstrap/node.js:276:5) at startup (internal/bootstrap/node.js:227:5) at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3) 

Then, I ran lsof -i | grep 3000, I got

node 6159 root 19u IPv6 58371978 0t0 TCP *:3000 (LISTEN) 

Then, I ran ps -aux | grep node, I got

root 448 0.0 1.4 569912 29600 ? Ssl 21:21 0:00 node /usr/bin/pm2 update root 1266 0.0 1.5 569400 31628 ? Ssl 21:28 0:00 node /usr/bin/pm2 update root 6159 1.0 2.4 845540 49568 ? Ssl 21:46 0:02 node /home/forge/bheng/public/ios-base-api/index.js root 6482 0.0 0.0 11244 948 pts/3 S+ 21:50 0:00 grep --color=auto node root 32233 0.0 1.4 569912 29876 ? Ssl 21:14 0:00 node /usr/bin/pm2 update 

I just want to start my nodejs app in the background and be able to access my endpoint anytime.

Why is this so complicated ? 😭

1 Answer 1

1

There are many packages which can help you. Check out pm2, forever

Both of them allow you to run your project in background and auto-reload is possible too :)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.