'Error: Cannot find module 'compression'
When I want to start my application it returns the following error:
Error: Cannot find module 'compression'
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> (.....\node_modules\webpack-dev-
server\lib\Server.js:11: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 have tried:
yarn installyarn upgrade- deleting
node_modules - etc...
But it's still not working. Can you help me please?
Solution 1:[1]
I've managed to solve this problem by running npm install --save @types/compression
Solution 2:[2]
Try:
npm i
This will install all missing node modules that are defined in your package.json.
Solution 3:[3]
Install compression
npm install compression --save
Solution 4:[4]
Try to delete:
- node_modules
- package-lock.json
and then run npm i.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Csaba |
| Solution 2 | Kelvin Schoofs |
| Solution 3 | Kai Esping |
| Solution 4 | Radim Šafrán |
