Hi there!
I'm Arisa, a freelance Full Stack Developer living in Germany🇩🇪
I'm developing Lilac, an online school with hands-on Frontend e-books and tutoring👩💻
What is this article about?
- webpack-cli error
An error log is in here👇
Would you like to install webpack-cli? (That will run npm install -D webpack-cli) (yes/NO)
If "yes"...
You'll see another pile of errors.
TypeError: Class constructor ServeCommand cannot be invoked without 'new' at runWhenInstalled
If "NO"...
Oh yes, he'll keep asking you forever the same questions.
Who is this article for?
- Anyone who suffers from this bazinga🚨
- Anyone has an old project with v3 webpack-cli
Which environment I had?
Seeing is faster than explaining, right?👍
"dependencies": {
"cors": "^2.8.4",
"express": "^4.16.2",
"mime": "^2.2.0",
"whatwg-fetch": "^2.0.3"
},
"devDependencies": {
"webpack": "^4.28.3",
"webpack-cli": "^3.2.0",// 👈 He's your devil😈
"webpack-dev-middleware": "^3.5.0",
"webpack-dev-server": "^3.1.14",
"webpack-hot-middleware": "^2.24.3"
}
How to get out from this error loop?
Just update your webpack-cli.
Minimum requires 4.3.0
from what people were crowding about this error.
In my case, I simply removed an old webpack-cli and got new.
$ yarn remove webpack-cli && yarn add --dev webpack-cli
"webpack-cli": "^4.4.0"
I know webpack updated to v5 last autumn. But I needed a compromised version to prevent getting another crash from other packages to test changing to webpack v5.
Mission accomplished👍
Top comments (5)
Thank you!
This could have been hours. Found you post and got out of that tar pit inside a minute. Creating an account at dev.to to post this "thank you" took longer.
Sorry for a late response..! Wow! Thanks for creating a dev.to account for that🙏 I'm really happy that my blog post helped you, Keith!
OMG this solved my problem too. Thanks a bunch for this!
also made an account just to thank you.
I Love U, Bro.