I\'m getting following Console Error.
Error : Cannot find module
Here is the full error i\'m getting in console. What should I do?
The path to the js file you're trying to execute is wrong; you have to type the path and the file name you want to execute relative to root where node is, but what you typed isn't where it is.
I typed node redux-basics.js
, got this slightly-misleading error message, Stack Overflow'ed, looked at my file system, and I should have typed node src/redux-basics.js
.
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
node_modules
directory package-lock.json
file npm install
npm start
OR
rm -rf node_modules package-lock.json && npm install && npm start
The particular .js file was in the sub folder (/src) of the application and Terminal was in general App folder.(which contains all package files,modules,public folder,src folder) it was throwing that error.Going to (/src) of application resolved my issue.
it finally worked for me after I did sudo npm i cjs-loader (and make sure to install express, not just express-http-proxy)
I uninstalled puppeteer, mocha and chai
using
npm uninstall puppeteer mocha chai
from the command line and then reinstalled using
npm install puppeteer mocha chai
and the error message simply never showed up