One day, out of nothing, my app decided not to die.
After pressing ctrl + c when I inspect port it's still there and not only on my machine but also on server that is managed by PM2 so I need to go there each time and kill the process by hand. I tried to look for issues in my code and when I couldn't I just though that it's simply one of the dependencies fault and soon there will be a fix. It was slightly annoying but I could kill the process with kill -9 PID and I had most of the tasks I had on front-end side so it wasn't that big issue. Today, more than a week later problem it's still here.
I went back in history, picked a commit that I made weeks ago, where everything worked perfectly fine, switched NodeJS from 5.1.0 to 4.2.1, cleared npm cache, reinstalled all dependencies and I still see the problem.
I'm using LoopbackJS, but normally I start the app simply with "node server/server.js" and then the problem described above happens, but if I use "slc run" and then try to kill the app with ctrl + c it just hangs forever, I mean I can press ctrl+c as many times as I want and it's still running in console foreground.
If instead of pressing ctrl+c I kill the tab in console, app dies without problems.
This is what I see after running "lsof -i tcp:4000" when the app is supposed to be dead but is not
Edit:
Running and killing it with Strongloop process manager - slc start/slc stop works fine but it would be more convenient to use normal way of running NodeJS app (node server.js) during development and it doesn't change the fact that there is some issue and it would be better to not hide it under the carpet.
Out of anger I stripped out my app to the most basic elements. File by file, piece by piece and I found the answer.
The culprit was phantomJS - https://github.com/sgentle/phantomjs-node. PATCH version 0.8.2 introduced this bug. Fix was created almost a month ago, merged a week ago but not published on npm yet.
Related
I used the npm command to create react app, after that my laptop fan started to get louder and when I tried to open any folder it's just not responding. File Explorer is frozen, it said loading the files but it will take forever. I just can't do my work.
I tried to restart File Explorer from task manager and it won't work.
The only way to fix it is to restart my laptop, but it will happen again sometimes even if I don't do anything with the react project. I just need to restart it a couple of times until it back to normal
The first time it happens I wasn't sure because it was the first time I tried to create react and my laptop also had some problems at the time, so I leave the react project for a month.
The second time is yesterday. When I tried to create react app again, File Explorer got freezing.
All this happen after I used the npm command.
Does someone know the answer? I've been trying to learn react and this makes me discouraged. Please help. (Sorry for my poor English)
I think your pc can't handle create react app. It's very heavy and consumes everything in your pc. Probably if you just let it install without using anything it will be ok.
So I'm getting a blue screen of death whenever I have "npm start" running for a reactjs app. It's an intermittent crash, i.e. it doesn't happen every time I run it nor are there any exact steps to duplicate the crash, but I'll try to explain below under what circumstances it happens.
Create a reactjs app using create-react-app npm module.
Start the app using npm start. Chrome window opens, webpack is listening to changes I make to the source files.
Change any source file, and save it. NPM compiles it, Chrome page refreshes, and I can see my changes.
The above things work fine as expected "normally", but once in a while, right after I save a file, the system crashes with a BSOD saying DRIVER_IRQL_NOT_EQUAL_TO_OR_GREATER_THAN (NETIO.SYS) There is no definite "step" or action other than saving the file, or refreshing Chrome that would cause this to happen, and it also doesn't happen every single time.
Here are the steps I took to find out/eliminate the root cause of this issue:
Disabled by AV (Symantec Endpoint Protection).
Use a different browser (Mozilla, hell, even IE).
Changed the system (used a different laptop, although the same type - Microsoft Surface on Windows 10)
Updated all drivers, etc. (Verified by my organization admins)
Closing all other programs, etc. that might potentially be interfering (Atom IDE, Eclipse, etc.)
The necessary conditions for the crash to happen are:
npm start must be running (webpack server on localhost:3000)
A browser window must be open connected to localhost:3000 (if no browser is connected, it doesn't crash even if you change and save the file 200 times - I checked). Also, doesn't matter which browser (Checked with Mozilla/Edge/Chrome)
I believe the crash happens when NPM is recompiling the files and serving it to the browser (asking it to refresh using some websockets), but I'm not an expert on NodeJS/NPM so I'm not sure.
I've been stuck on this issue for more than 2 weeks now. Any help would be really appreciated. Kindly let me know if more information is needed.
The issue was with Symantec DLP (Data Loss Prevention) that was also installed on all our systems. The issue resolved itself after the admins added application exceptions for Nodejs, NPM, my reactjs project workspace paths.
Just posting this so that in case someone has a similar issue they can try this or remove Symantec DLP altogether.
I have my work computer which is a Windows 10 Pro and my laptop is a Windows 10 Home. Working on the same project on both: push and pull to Git. Learning React through Udemy. Both computers using Chrome. Both using Bash on Ubuntu on Windows with latest updates. Both using ConEmu for the console. Both npm -v = 3.10.10. Both node -v = 6.11.2. Hardware is different obviously, but not sure that is relevant and worth listing.
Anyway, this starter project I am playing around with, when I make changes to it and npm start is running, you can see activity in the console, hit refresh in the browser, and any changes made will be reflected.
On the laptop, this process does not work. Make change, save, no activity in console, refresh in browser does not reflect the changes. Have to restart npm start for changes to be reflected. A little irritating to say the least.
Anyway idea what might cause this? Really haven't come across anything in my Googling efforts.
If you are using npm in WSL2.0 for development, please refer the last point in this-
https://create-react-app.dev/docs/troubleshooting/#npm-start-doesnt-detect-changes
While WSL1.0 doesn't use a VM, WSL2.0 does use a lightweight VM, so adding
CHOKIDAR_USEPOLLING=true
in a .env file in the project directory fixed the problem.
On a sidenote, you might wanna take a look at this
Client side
To ensure client side changes aren't being cached, you can open devtools > Network, and check "Disable cache". After enabling this, you won't have anything in the cache as long as devtools is open.
Alternatively, you can use incognito / private browsing mode to prevent the cache from holding on to things.
Server side
I'm sure you've realized that it's a pain to restart your server every time you want to see your code update. There are several tools that will detect file changes and handle restarting the server automatically.
PM2
Nodemon
Forever
I just add file .env and inside FAST_REFRESH=false.
For me, working in Windows, WSL2 caused this not to work. Running npm start in Command Prompt, not WSL solved this issue for me.
Am using Plotly's Dash and trying to run the sample app code which they have provided here: https://plot.ly/dash/getting-started#dash-app-layout
Am having trouble with the ports. The code on being run shows this in the console:
However , even after making changes to the code, the output in the web app shows no change.
Basically, when I'm implementing a different code: the web app continues to display the output from the previous run!
The CTRL+C doesn't seem to help and doesn't really quit or cause any change to the application. Please let me know what shall help.
I ran the new code using a new port(8049) and that worked but doesn't solve the initial basic issue!
I've had the same issues, and find that a full restart of the app is necessary to get some changes to propagate in the app after a file update.
In POSIX, you could run sudo killall python or similar. Looks like you're running Windows, so taskmanager or taskkill /F /IM python.exe.
The [1]: Looks like a Jupyter kernel is running? If so, try restarting the kernel.
For me CTRL+C doesn't work either, but CTRL+Pause/Break button stops execution.
I am trying to get a node.js application working on a CI server (Team City). I have a build step which goes like this...
npm start "path/to/my/app"
And it works however the build step hangs because the console will not shut down (it can't because it needs to stay open to run the server). So what can I do to get Team City to kick off the command line without staying open?
You are facing a more general problem of running node.js as a background service (the one that does not hold the console etc.)
Common solution to this is to use Forever CLI tool