Why does PM2 work on one server, but not on another? - node.js

We have two instances of our Node-Express app: one for development, and one for production. We are implementing PM2 process manager. This is for a Windows Server 2012 environment.
For some baffling reason, PM2 (with pm2-windows-service) worked fine when set up in our dev environment, but won't even run node in our Prod environment. What could be the cause?
Log files reveal nothing helpful
If you look at my related question, you can see that PM2 appears to be launching node, but is not (or it instantly crashes).
All we can conclude is there is some difference in settings between these two servers. Any clue what difference in settings might be causing PM2 to fail like this?
This is related to a more specific question I have out there about issues we're having implementing PM2.
Thank you!

Ok, I got the answer after posting an issue to the pm2 github issues page.
Sharing it here in case anyone else finds themselves in this situation:
https://github.com/Unitech/pm2/issues/4113
(basically pm2 3.2.5 introduced a bug that causes this issue in Windows. My QA install was 3.2.4. The issue was resolved by reverting to 3.2.4. Simple process, see instructions at link above.)

It may be not really pm2 issue, bit more npm. On the server where pm2 doesn't work please try that command in PowerShell:
Get-Command pm2
Does it return the correct version(not 0.0.0)? If not, there is an issue diring installing that package, so as an option it's possible to install that manually. Also we asked familiar question in that ticket last month:
https://github.com/Unitech/pm2/issues/3964
Like it described in a ticket above you can try to check other npm package with familiar issues:
npm install mocha -g
And that try to reach mocha-cli

Related

Node cannot run serverless cmd

I tried updating both Serverless module and Node, but still receives the same error.
I count not even find the solution in the internet for this simple problem.
can someone suggest.
The issue for me was that I was missing the following directory in my Windows PATH env variable:
%AppData%\npm
Once I added that I could run serverless, SLS, etc.
Don't forget the restart your PC.

Node JS Randomly stops executing - Shows no errors

I am not sure where to start looking for the issue here.
I recently updated from angular 5 to angular 8. The application runs fine after the update. I don't know if this is related.
All of the sudden, my Node JS scripts stop seemingly at random. Sometimes they run, usually they don't. This is any script.
By "Stopping" I mean the console, mid execution, leaves the last line it wrote up, and on the next line, I am able to write more commands.
Example:
C:\location\> npm start
ng serve --aot
** Angular Live development server is listening on .....*
12 % building 22/23 modules 1 active ...somefile.ts
C:\location\>
There is no error, even when I run --verbose. Also, if I have multiple windows up or multiple servers running, they all stop at the same time. It is happening regardless of the application or package, including http-server, Angular, and installing dependencies.
I couldn't find anything related online. Has anyone ever seen this?
Update:
The issue is caused by my lack of CPU.
I thought I fixed it by updating, but that didn't work.
----------- (previous reply, not a solution)
It appears some of my installed dependency versions conflicted with package.json. Basically something did not fully update as expected.
I resolved the issue by running npm install.

Issues running React app on Windows environement

I have a working react app that I had hosted on a linux environment, but the client has switched their hosting provider and now I have to run the app on a Windows environment. I personally am unfamiliar with Windows and having some serious issues getting my app to work now.
After loads of debugging and testing I now can get my app to run, but when I start it, it will throw some errors which will results in a broken app in the browser.
So when I run npm start it will start up the app and spit out this error:
Screenshot of the terminal error 1/2
Screenshot of the terminal error 2/2
It seems to spit out some complaints when using npm run watchJS which runs this command babel src --watch --out-dir lib.
I am completely lost at this point and have no idea where to go from here.
I can provide as much detail as anyone needs after looking at the question, I just don't know what else to add to this issue and don't want to fill up this question with irrelevant info.
Thanks in advance for any help
It is likely a bug with the version of npm you are using.
See this thread:
https://github.com/npm/npm/issues/18380
Try rolling back your version of npm to 5.3
The issue appears to be exclusive to windows with babel packages.

npm never ending process while installing angular 4

I am trying to install new angular 4. I have upgraded my node to the latest version, 6.11.2, and my npm to 3.10.10. I trying to install angular-cli globally but it took hours,still no success.
I see many of us have the same problem. I tried their solution by disabling my firewall as well as progress bar, unfortunately, no success in my case.
Can anyone help me please?
Thanks.
I found a solution from one of the posts on the forum. The problem was with the system environment variables, I had duplicate temp variables which were causing a crash during the execution. I have removed the duplicate variables and restarted my computer, and it worked perfectly. Hope it will help someone.

Node won't run, just exits code 0

Well some days ago I was tired to always call sudo when calling npm install and that sort of things so I tried uninstalling node and tried installing via Homebrew, I managed to make a huge disaster but finally it worked. Until now...
When I run node app.js or npm install it just doesn't do anything.
I tried deleting the related files like this.
I tried using nvm.
Tried the manual install with the .pkg file from the node homepage.
Tried through homebrew again.
And still no luck; however if the Node app has compilation errors I get the error stack, but when everything is "ok", instead of start listening for incoming connections it just exits with code 0.
Ok, I feel reaaaaaaaaally stupid after I found the issue, in my postgresql config I had the wrong password for the database and for some reason caused all this mess. Will upvote all of you, will understand if you downvote me for being such a moron.
OneOfOne's node debug then keep pressing s did the trick for me.

Resources