Webpack starts failing after it was working with no changes in configuration

558 views Asked by At

I started getting the following error on my build server in the last few days

npm : keywords if/then/else require v5 option
At line:16 char:1
+ npm run build:dev
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (keywords if/then/else require v5 option:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandErro

What I am wondering is, how can errors come from nowhere like this? no code has been changed since it was working, and all of the sudden it starts failing one day. Aren't I locked into specific version from my package.json file? If authors of packages make changes that break things, shouldn't I be shielded from those?

Any help is appreciated. I am just trying to understand how this keeps happening.

1

There are 1 answers

0
Okeydoke On

If you look at your package.json dependencies you'll most likely see ^ character on the versions eg ^3.0.1 this effectively matches minor and patch versions, usually. For full details check out the semver module used by node https://github.com/npm/node-semver#caret-ranges-123-025-004

There's a few edge cases with a leading 0 and not sure how it handle things like 2.1.0-beta.21 which is possibly the issue you've had with webpack.

Also see http://semver.org/