Reputation: 1823
I was running a node server w/o any issue and for some purpose had to remove the node_modules dir and re-install the dependencies. Upon doing so and running the server again I get this error :
Error: Cannot find module './common'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Work\Cinde-Node\node_modules\debug\src\node.js:236:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
I installed common
separately using npm install common
but that didnt solve the problem.
How do I fix this ?
Upvotes: 3
Views: 7969
Reputation: 11
I was also facing same problem like:
Error: Cannot find module './sdam/common'
So I just removed the node_modules
folder, then just ran command npm i
.
That will download every dependencies mentioned in package.json
file.
Upvotes: 1
Reputation: 1
I was getting the same error when I tried running my express project. The following command helped me to fix the issue.
rm package-lock.json && rm -r node_modules && npm i --save --legacy-peer-deps
Upvotes: 0
Reputation: 471
It looks like you have a line like
require('./common');
it should be
require('common')
Upvotes: 3