Confused about dependency version resolution priority

cli

(Michael Peyper) #1

Iā€™m having an issue where the wrong version of babel-core is ending up in the root node_modules folder. Running npm ls babel-core shows:

my-package@4.0.0 /Users/<username>/projects/my-package
ā”œā”€ā”¬ build-scripts-core@1.0.3
ā”‚ ā”œā”€ā”€ babel-core@7.0.0-bridge.0
ā”‚ ā””ā”€ā”¬ babel-plugin-emotion@9.2.6
ā”‚   ā””ā”€ā”¬ babel-core@6.26.3
ā”‚     ā””ā”€ā”¬ babel-register@6.26.0
ā”‚       ā””ā”€ā”€ babel-core@6.26.3  deduped
ā””ā”€ā”¬ build-scripts-external-preset@1.0.3
  ā”œā”€ā”¬ build-scripts-jest@1.0.3
  ā”‚ ā”œā”€ā”€ babel-core@7.0.0-bridge.0
  ā”‚ ā””ā”€ā”¬ jest-cli@23.4.2
  ā”‚   ā”œā”€ā”¬ jest-config@23.4.2
  ā”‚   ā”‚ ā””ā”€ā”€ babel-core@6.26.3  deduped
  ā”‚   ā””ā”€ā”¬ jest-runtime@23.4.2
  ā”‚     ā””ā”€ā”€ babel-core@6.26.3  deduped
  ā””ā”€ā”¬ build-scripts-webpack@1.0.3
    ā””ā”€ā”€ babel-core@7.0.0-bridge.0

The version in the root folder node_modules folder is 6.26.3 but I would have expected it to be 7.0.0-bridge.0 given that any package bringing it in is beneath one bringing in the higher version, but not knowing exactly what order the packages are installed in, Iā€™m not sure if this assumption is correct or not.

Assuming npm is behaving correctly, other than specifying the desired version in my-package's package.json, is there anyway I can have the version specified in build-scripts-core's package.json installed at the root?

I have complete control to update the build-scripts-xxx packages, but I do not want the dependency details to leak outside if possible. The reason for this is the whole point of these packages is to abstract away the tools used in maintaining the projects in a similar way that create-react-app or kcd-scripts does.


(Rebecca Turner) #2

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.