NodeJS Application stops instantly after start - node.js

I am trying to run a NodeJS application on Windows 7. It was created on a MacOSX and it worked fine, started it on a CentOS too and it's OK, but when I run it on Windows with
npm start
Node spits out the usual starting of a line:
C:\Git\My.App.2014>npm start
> MyApp#0.0.1 start C:\Git
> node ./bin/www
C:\Git\My.App.2014>
And instead of running the server, it just stops instantly. Any ideas?

Related

Node/TS-node crashing without a stack trace

I'm having an issue where a node project suddenly started crashing on launch with merely a error Command failed with exit code 1. The project is ApolloServer/Express based.
Start script: ts-node src/app.ts
Running via ts-node crashes right after express().listen() logs "Server is starting" message
Running through pm2 will cause a crash loop before randomly working
Running via ts-node-dev works (Uses the same version of ts-node)
Running on Windows 10 works
ts-node: "9.1.1"
ts-node-dev: "1.1.8"
typescript: "4.4.4"
node: "14.13.1"
yarn: "1.22.17"
Debian: 9.13

Pm2 starts the process but node app inaccessible

I'm new to PM2 and nodejs, I'm trying to learn node by following simple sample that creates a server that displays 'Hello World' from the browser. Please note that I'm running node on QNAP NAS. I have successfully installed nodejs, npm, and pm2. when I run app.js via node app.js, it works and I see the message using the port specified.
but when I run via pm2 start app.js, I got this
Then after a few seconds I got status = errored
when I look at the log I got this.
I tried searching in google but the result were pointing to old version of node which I don't
Node itself has to be built with inspector. You can try to install LTS version of node.
Alternatively, you can try installing node-inspector with npm i node-inspector --save

Nodejs automatically shuts after running for some time

My environment is ubuntu 16.04 with npm 5.0.0 and node 8.0.0 installed. I created an express application and started it with nohup npm start & in the application root directory. However, a couple of minutes later the app became unreachable and the process was lost. I tried restarting several time but the process always automatically exits. How can I start a long-running nodejs app?
Use pm2 daemon for setting Up a Node.js Application for Production on Ubuntu 16.04
Follow commands
sudo npm install -g pm2
pm2 start server.js //Yor main node server.js
pm2 stop server //no need of giving .js , .js only required at start of process
pm2 restart server //for any changes are done to restart
For more You can follow digital ocean tutorials for more details from below link
Digital_Ocean_Link

How to run server which runs through ng server or npm start as a daemon process?

I have a demo application using angular 2. I usually run it through npm start and it runs. But, I want to run a server which is equivalent to whatever is running just like apache daemon process. Because when I run it through npm start or npm start & and close the terminal the server is also closed.

Running Ionic commands whilst "ionic serve" is running

Just getting started with Ionic 2. When i have the app running in NodeJS, I cannot seem to add commands such as "ionic g providers myapi" - I assume these can only be entered when ionic serve is not running?
Also previously using Ionic1 I could stop ionic serve using quit in the CLI, but there seems to be no way of typing anything when ionic serve is running in the NodeJS console. So I have to currently do a hard close andd re-start the NodeJS application (I am running on Windows 8)

Resources