Node JS Randomly stops executing - Shows no errors - node.js

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.

Related

Nodejs crashes during development cause continuous 'EADDRINUSE: address already in use'. Workaround?

I'm working on a node.js script and it crashes sometimes because it's still in development. Every time this happens though I get an EADDRINUSE error and I have to go ps ax | grep 'node server' and then kill the_pid. This is extremely time consuming. There must be a work around. Is there?
I had nodemon installed globally. I uninstalled the global installation. I installed it as a dev dependency and that appears to have solved the problem; I no longer get the address in use error.

Node serving an old version but still compiles updates

I'm creating a React application and am running into this issue. When I make changes to code, Node does recompile and even recognizes errors in the code, but no matter what, the localhost in the browser remains unchanged. Here's a list of things that I've tried:
Clearing the browser's cache and hard reloading the page
Switching browsers
Turning Node off and on again
Reinstalling Node
Creating a new directory, copying over the code, and then installing Node there
Turning the whole computer off and on again
I'm not sure what to try anymore. When installing Node, there are no errors, and no errors if I run npm start or npm build. As I said, I know Node is looking in the right directory since it recognizes when I make changes and shows errors when the code fails to compile. I also know I'm looking at the right localhost page since it isn't available when Node isn't running. However, the page remains perfectly usable and unchanged even if the code fails to compile, and actually is able to load before Node compiles all of the code.
I got the code itself from a zip file from GitHub and people who have their frontend set up have no issues with it. Node and all the other dependencies were downloaded by me, again, with no errors.
I'm using Node v10.16.0 and npm v6.9.0

Why does PM2 work on one server, but not on another?

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

Angular application throws exception at compile time

I have an Angular 2 application, running in Electron and using Knex for database interaction that has successfully compiled and run several times over. After several edits, I attempted to run the application locally and received the error ReferenceError: "yexecutor is not defined".
Googling the error yielded no results. I have gradually commented out every line of custom code written by me and still the error occurs. I've even rebooted my rig thinking, perhaps, Node was just acting up. After a reboot, I'm still getting the error.
After commenting all of my own code, rebooting and finally dying and coming back to life to try again, I remembered I was investigating the source of some of the packages I had installed. So, I decided to try deleting the node_modules directory and execute an npm install.
A few minutes later, I'm back to a successful compile!
Steps to solve:
Delete node_modules
npm install
I must have fat fingered the keyboard while meandering through the packages! That, or my cats decided to become contributors.
Viola!

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.

Resources