Skip to content

Symlinking packages may lead to invalid states #937

@jiripospisil

Description

@jiripospisil

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

Bug.

What is the current behavior?

An unlinked (but added) package is missing from node_modules and yarn will not install.

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

  1. Link a random package

    git clone [email protected]:tj/co.git
    cd co && yarn link
    

    As a side note, yarn will not install the package's dependencies. The default npm client would do that. I'm not sure whether that's expected or not given that the linking process is slightly different already.

  2. Create a new directory and use the linked package from there

    yarn link co
    
  3. Add the package again but this time via add

    yarn add co
    

    The linked package is still used at this point (and that's consistent with the default client).

  4. Unlink the package

    yarn unlink co
    

    This will remove the link from node_modules as expected.

  5. Run yarn to get the added (locked) package back

    yarn
    yarn install v0.15.1
    warning No license field
    success Already up-to-date.
    Done in 0.13s.
    
    ls node_modules
    

    At this point, the package is not present in node_modules but yarn seems to be okay with that and won't install it. Doing yarn add co again will install it.

What is the expected behavior?

The package should be installed after unlinking it and running yarn.

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

Node.js 6.7.0
Yarn 0.15.1
Ubuntu 12.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions