[Fixed] Internal/modules/cjs/loader.js:892 throw error

React JS Tarif Hossain

Problem:

Sometimes we are getting the following error in our console internal/modules/cjs/loader.js:582 throw err Error: Cannot find module in nodejs.

internal/modules/cjs/loader.js:582
    throw err;
    ^

Error: Cannot find module 'D:\project\TherapiProject\app.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)



Solution:

1. Delete the node_modules directory

2. Delete the package-lock.json file

3. Run npm install

4. Run npm start

Just run the below command to solve your error:

rm -rf node_modules package-lock.json && npm install && npm start

Hope this solution helped you a lot. Comment below Your thoughts and your queries.