Yarn: Yarn recursively deletes all bower.json files

Created on 11 Oct 2016  路  5Comments  路  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?
Bug

What is the current behavior?
Running yarn on an existing project deleted several bower.json and .bower.json files, which weren't even in the root of the current project.

These were files that existed within the test directory, used in unit tests. However, I think it's unacceptable that yarn removes _any_ files without warning or even a message on the command line.

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

  1. Clone this repo: https://github.com/OverZealous/cdnizer
  2. Run yarn at the root
  3. See changes:
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    new file:   yarn.lock

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    deleted:    test/bower/components/angular/bower.json
    deleted:    test/bower/components/no-bower-version/.bower.json
    deleted:    test/bower/components/no-bower-version/bower.json
    deleted:    test/bower/components/no-dot-bower-version/bower.json

What is the expected behavior?

  1. Existing bower.json and .bower.json files should be left as-is.
  2. A warning should be given any time a file is to be removed, especially if it's not within the node_modules (or possibly bower_components) directory.

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

  • node -v: v5.12.0
  • yarn --version: 0.15.1
  • OS: Mac OS X 10.11.6

Most helpful comment

This is a different problem than removing files within bower_components, there's a separate issue reported for that already.

This issue is that it's removing the bower.json files themselves, and they weren't even in the same directory.

While I agree that yarn shouldn't be touching Bower setups, we should make sure each issue stays focused.

All 5 comments

Same here, I was really surprised when yarn deleted 2220 files (all bower dependencies in a dir named components).

Same here,
yarn simply removes all files in my bower_components directory.

The workaround that fixed my issue (I _think_ I had that issue because I have package.json and bower.json in the same directory) was this:

yarn -> mv package.json p.json -> yarn -> mv p.json package.json

The first yarn installs npm dependencies and removes bower dependencies and the second one installs bower dependencies.

This is a different problem than removing files within bower_components, there's a separate issue reported for that already.

This issue is that it's removing the bower.json files themselves, and they weren't even in the same directory.

While I agree that yarn shouldn't be touching Bower setups, we should make sure each issue stays focused.

We've removed support for Bower, see #1441.

Was this page helpful?
0 / 5 - 0 ratings