npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

webpack's dependencies seem to stay unresolved. Order of dependencies relevant?


lately I installed webpack indirectly as a dependency of symfony’s webpack-encore.
Here is an extract of its package.json.
Just focus on the order of dependencies to follow my explanation.

      "_from": "@symfony/webpack-encore@^0.20.0",
      "_id": "@symfony/webpack-encore@0.20.1",
      "dependencies": {
        "babel-preset-env": "^1.2.2",
        "css-loader": "^0.26.2",
        "extract-text-webpack-plugin": "^3.0.0",
        "webpack": ">=2.2.0 <4",
      "version": "0.20.1"

As you can notice, babel comes before css and if I query npm as such

$ npm ls browserslist
`-- @symfony/webpack-encore@0.20.1
  +-- babel-preset-env@1.7.0
  | `-- browserslist@3.2.8
  `-- css-loader@0.26.4
    `-- cssnano@3.10.0
      +-- autoprefixer@6.7.7
      | `-- browserslist@1.7.7
      `-- postcss-merge-rules@2.1.2
        +-- browserslist@1.7.7
        `-- caniuse-api@1.6.1
          `-- browserslist@1.7.7

then you can see, that the newest version of browserslist is the first descendant in this tree. Also this newest browserslist package has become a top level directory of my project’s root node_modules directory.
The remaining older browserslist package versions (@1.7.7) reside as subfolders in node_modules/autoprefixer/node_modules,

As soon as the next dependency “extract-text-webpack-plugin”: “^3.0.0” of @symfony/webpack-encore gets resolved, there will be this particular version of the ajv packet residing at my project’s root node_modules directory:

$ npm ls ajv
`-- @symfony/webpack-encore@0.20.1
  `-- extract-text-webpack-plugin@3.0.2
    `-- schema-utils@0.3.0
      `-- ajv@5.5.2

So at the top level of my project’s root node_modules directory there is no free slot for any further ajv packet. Version ajv@5.5.2 has been saved in

When it comes to the last dependency resolution as for “webpack”: “>=2.2.0 <4”,
we run into trouble:
I got the following warning message:

npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.

But there is one ajv packet version that meets the requirement of ^6.0.0 and is installed in
D:\Checkoutspace\branch\imgresize\node_modules\webpack\node_modules\ajv. Here an extract of its package.json:

  "_from": "ajv@^6.1.0",
  "_id": "ajv@6.5.4",
  "_requiredBy": [

I have re-checked npm’s answer after the complete installation and it still can’t find it:
$ npm ls ajv
-- @symfony/webpack-encore@0.20.1– extract-text-webpack-plugin@3.0.2
-- schema-utils@0.3.0– ajv@5.5.2

But why can npm not find it the same way as it does for the browserslist package.
Is the reason the order of dependency installation?

And by the way. Can I actually ignore that warning, because in fact there is one ajv version in node_modules\webpack\node_modules\ajv and just npm complains falsly?

Thanks in advance for any idea on this issue.

$ npm version
{ npm: '6.4.1',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.12.0',
  openssl: '1.1.0i',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '',
  zlib: '1.2.11' }