Yarn: Dependencies installed via file protocol contain unnecessary files

Created on 31 May 2017  ·  3Comments  ·  Source: yarnpkg/yarn

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

bug

What is the current behavior?

When I install a dependency with via file: protocol it contains more files like a normal dependency, because white- and blacklists for publishing (.gitignore, .npmignore, "files" in package.json...) aren't respected.

Now directories like node_modules/ of _this_ one dependency land in the cache, too. This results in a _very long_ Linking dependencies... phase.

The workaround:

  • Open yarns cache directory.
  • Look for dependencies which were installed via file:.
  • Manually remove unwanted files and directories.

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

  1. Create a new package.json in a fresh directory and try to install a new local dependency (which contain a node_modules/ directory for example) via file:.
  2. Look in $ yarn cache dir for this dependency and you'll see a node_modules/ directory there. (This isn't the case for other packages in your cache which aren't installed via file:.)

E.g.

{
  "name": "some-example",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "some-dependency": "file:../some-dependency/"
  }
}

What is the expected behavior?

Respect white- and blacklists for publishing for file: based dependencies, too.

Please mention your node.js, yarn and operating system version.

  • Node: v6.9
  • yarn: v0.24.6
  • operating system: Mac OS X 10.12.4

Most helpful comment

Cool, Thank you for sharing the issues ❤

All 3 comments

This is a duplicate of a couple other issues, but I can't seem to find them right now (I feel like GitHub search is totally broken sometimes!).

Yarn currently (v0.24.x) checks the file lists (files in package.json for example) when publishing a package, but not when extracting/installing a package.

If I can find those related issues I'll link them here... but I at least wanted to comment that this is a known issue.

Ah, found them...

Duplicate of #2822 #3385

Cool, Thank you for sharing the issues ❤

Was this page helpful?
0 / 5 - 0 ratings