Temporary solutions:
--legacy-peer-depsI want to install webpack-dev-server with: npm i -D webpack-dev-server
Succesful installation without any errors.
I receive an error during installation.
npm ERR! code ERESOLVE
npm ERR! Cannot read property 'length' of undefined
2020-11-21T14_49_45_952Z-debug.log
Create a new folder, run npm i -D webpack webpack-cli webpack-dev-server
I can install webpack and webpack-cli without errors.
Seeing the same issue on macOS.
Node 15.2.1
npm 7.0.10
webpack 5.6.0
Probably related: npm/cli#1749
And indeed, --legacy-peer-deps allows webpack-dev-server to be installed.
Yes, it is npm bug
Not sure how we can fix it on our side
I have the same issue, I downgrade my node version 14.15.1 using nvm and worked. This is not a solution, but can help if someone don't know that to do.
Please open an issue again in npm, their latest innovations are just crazy, a lot of regressions, even it is require --legacy-peer-deps they should provide friendly error, not like Cannot read property 'length' of undefined, we can't fix something here, even you will write +1 or same here will not allow to solve the issue
I updated my initial post to provide temporary solutions for others who will search for this error.
This fixed it for me for now at least : npm i --save-dev webpack-dev-server --legacy-peer-deps
Most helpful comment
Probably related: npm/cli#1749
And indeed,
--legacy-peer-depsallows webpack-dev-server to be installed.