If, at some point, you’re working on some front-end code using NPM and when you attempt to install a package, you get a message that resembles something like this (you’re mileage obviously may vary):

TypeError: Cannot read property 'properties' of undefined
at Object.<anonymous> ([...]/node_modules/webpack/bin/webpack.js:156:2)

That is, the primary problem being: TypeError: Cannot read property ‘properties’ of undefined

The best solution I’ve found to the problem is to remove webpack and the webpack-cli and reinstall it using the --save-dev directive.

Specifically, entering this into your terminal:

$ npm remove webpack webpack-cli && npm install --save-dev webpack webpack-cli

Note that --save-dev will essentially be needed when only developing your project. It’s not necessary to have it as part of your release. But when you’re working locally, having the development dependencies can help with whatever build errors you may get.