internal/modules/cjs/loader.js:582 throw err
- Delete the
node_modules
directory - Delete the
package-lock.json
file - Run
npm install
- Run
npm start
OR
rm -rf node_modules package-lock.json && npm install && npm start
I had the same issue when I first tried on node js.
I noticed this issue was happening to me because I had some .js files with same names in different directories, which were in the same main directory.
I created another directory outside the main project folder, and created a .js file.
After that, it ran fine.
ex- app.js
try following command
remove node_modules
and package-lock.json
rm -rf node_modules package-lock.json
then run following command to install dependencies
npm install
finally, run your package by following command.
npm start
I was having the same error because I had a space at the end of my filename(not the reference but the actual filename). Once I changed 'app.js ' to 'app.js' it worked fine.