webpack: Cannot read property 'match' of undefined webpack: Cannot read property 'match' of undefined symfony symfony

webpack: Cannot read property 'match' of undefined


Simple answer just run

rm -rf package-lock.json


Try to delete package-lock.json and node_modules folder and after that run npm install or yarn install


An additional reason for this message can be a mismatch between the npm major version that the package-lock.json was generated with and the version the npm install is run on.

If for example the lockfile was generated using npm@5 and later you try to npm install on npm@6 because of lets say a minor node@8 update you will see this error.

The solution here is like mentioned in the other answers to remove node_modules and package-lock.json and npm install on npm@6 again. Or stay on npm@5 for lockfile and later install.