Tag Archives: node

Throw Er of node error// Unhandled ‘error’ event solution

node Error:

Starting child process with 'node web.js'
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::8000
    at Object._errnoException (util.js:992:11)
    at _exceptionWithHostPort (util.js:1014:20)
    at Server.setupListenHandle [as _listen2] (net.js:1355:14)
    at listenInCluster (net.js:1396:12)
    at Server.listen (net.js:1480:7)
    at Object.<anonymous> (C:\Users\Administrator\Desktop\node\node\11\web.js:39:4)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
Program node web.js exited with code 1

Error reason:

The port number is occupied.

Solution:

Modify the port number, or take out the port number and restart the project

24178;- 25481;- 31471;- 21495;- p>

1.36827;- cmd20196;- 31383;- 20889;- netstat -ano-1244findstr “8080”

2.taskkill -PID 13512 -F

NPM Command Error: Allocation failed – JavaScript heap out of memory

Error occurred when executing NPM command:

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed – JavaScript heap out of memory

The reason is that there is not enough memory in JavaScript heap. Node is based on V8 engine. When using memory through JavaScript in node, only part of memory can be used (about 1.4 GB in 64 bit system). If memory is not enough, you can use the following methods to relax the default memory limit of V8.

Method 1:

add parameters  — max_ old_ space_ size=4096

npm run start --max_ old_ space_ size=4096

Method 2:

modify the CMD file

In the directory node_ Open ng.cmd and ngc.cmd files under modules /. Bin, and add  — max_ old_ space_ size=4096

Method 3:

through the increase memory limit plug-in

Install plug-in: NPM install – G increase memory limit

Execute command: NPX cross env limit = 4096 increase memory limit

Through the log, we can find that it will add the — Max old space size = 4096 parameter to all the places where the node command is executed