I am new to Node.js, try to learn express to build my first web application. I got stuck on my very first sample code and need some help to get it running. Before I post th
I've came across a similar problem and in the end it was a matter of some old dependencies that were messing up my Heroku server.
While at my project's folder I've run:
npm uninstall
npm install
I hope it helps
Have you tried
npm install
If you're specifically looking for just express
npm install --save express
It says
Cannot find module 'express'
Do you have express installed?If not then run this.
npm install express
And run your program again.
npm install --save expressThis worked for me, Just run express.js installation again
In rare cases, npm cache may get corrupt. For me, what worked was:
npm cache clean --force
Generally, the package manager will detect corruption and refetch on its own so this is not usually necessary. However, in my case Windows 10 crashed a few times and I suspect this may have been during a fetch operation. Hope it helps someone!
More information: https://docs.npmjs.com/cli/cache
Run npm install express body-parser cookie-parser multer --save
command in the same directory with your source code nodejs file to resolve this issue.
P/s: check your directory after run command to understand more!