Home > OS >  All React app not running on my pc using npm start. Cannot resolve the error
All React app not running on my pc using npm start. Cannot resolve the error

Time:03-28

'npm' has stopped working and giving the error attached below. Also while running any react app on my laptop using ~npm start I am getting the same error. Please help.

PS C:\Users\LENOVO\Desktop\react\portfolio> npm start
C:\Program Files\nodejs\node_modules\npm\node_modules\agentkeepalive\lib\https_agent.js:1
$→��m��mo�L�D��;�%g�?w��ŷ↓�▬��ovH0��a�5��*�ؒ��l͛�S�iy☺�r�O7����%L]��%��∟�hk
 ^

SyntaxError: Invalid or unexpected token
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1031:15)
    at Module._compile (node:internal/modules/cjs/loader:1065:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\agentkeepalive\index.js:4:29)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)

CodePudding user response:

delete node_modules and re-run npm i, then npm start

CodePudding user response:

For some reason, the npm\node_modules\agentkeepalive\lib\https_agent.js file used by Node's bundled npm has been corrupted. (Your hard drive may be going bad – might want to keep an eye on it, or it may be something else.)

The easiest way to fix it, since you can't run npm to fix npm, should be to just reinstall Node.js (or if there's a Repair option for it in Windows' Settings, you could try that).

CodePudding user response:

delete node_modules folder, then install yarn

npm install --global yarn

then install all the packages with yarn.

yarn install

then try to start live server with yarn

yarn start

it will run.

  • Related