Yarn: Yarn introduces extraneous dependencies

Created on 5 Jun 2017  ·  3Comments  ·  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?
A bug

What is the current behavior?
Running yarn introduces an extraneous dependency. That is, a dependency is placed in node_modules, but cannot be traced to a parent dependency that exists in package.json.

If the current behavior is a bug, please provide the steps to reproduce.

  1. git clone https://github.com/Apicurio/apicurio-studio
  2. cd apicurio-studio/front-end/app
  3. npm install && npm ls | grep extraneous shows no extraneous packages (with both npm 3.10.10 and npm 5.0.2)
  4. yarn && npm ls | grep extraneous shows ├── [email protected] extraneous (with yarn v0.24.5)
  5. yarn list shows that [email protected] is a first-order dependency: ├─ [email protected]

What is the expected behavior?
Yarn should not add dependencies that are not derived from first order dependencies as they are shown in package.json

Please mention your node.js, yarn and operating system version.
node v6.10.2
yarn v0.24.5
macOS Sierra 10.12.5 Darwin Kernel Version 16.6.0

Could be related to https://github.com/yarnpkg/yarn/issues/2708

Most helpful comment

Wow yarn why! Thanks :)

But still, even though yarn is happy with how things are placed in node_modules, the incompatibility with npm introduces friction for some users. Is this an issue for yarn folks?

I'll rephrase the expected behaviour for this case - I expect yarn to produce a node_modules structure that is compatible with how npm does it, in terms of metadata etc. Is this just me expecting this? :)

All 3 comments

node-pre-gyp is required by fsevents:

❯ [mael-mbp?] apicurio-studio/front-end/app git:(master) ❯ yarn why node-pre-gyp

yarn why v0.23.4
[1/4] 🤔  Why do we have the module "node-pre-gyp"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
info This module exists because "lite-server#browser-sync#chokidar#fsevents" depends on it.
info Disk size without dependencies: "232kB"
info Disk size with unique dependencies: "1.47MB"
info Disk size with transitive dependencies: "6.9MB"
info Amount of shared dependencies: 63
✨  Done in 0.59s.
❯ [mael-mbp?] apicurio-studio/front-end/app git:(master) ❯

I'm gonna close this issue, feel free to reopen it if I'm mistaken :)

Wow yarn why! Thanks :)

But still, even though yarn is happy with how things are placed in node_modules, the incompatibility with npm introduces friction for some users. Is this an issue for yarn folks?

I'll rephrase the expected behaviour for this case - I expect yarn to produce a node_modules structure that is compatible with how npm does it, in terms of metadata etc. Is this just me expecting this? :)

Was this page helpful?
0 / 5 - 0 ratings