-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Doing some yarn command a second time using workspaces feature may fail with There are more than one workspace with name "XXX" error if a package is conflicting and not hoisted at top-level and when the workspaces option is a glob englobing pattern.
If the current behavior is a bug, please provide the steps to reproduce.
See https://github.com/maoueh/yarn-workspace-already-exist-bug that has all the instructions, copied here for easiest repro:
-
Clone repository
$ git clone https://github.com/maoueh/yarn-workspace-already-exist-bug.git /tmp/yarn-workspace-already-exist-bug -
Yarn install once
$ cd /tmp/yarn-workspace-already-exist-bug $ yarn install -
Yarn install a second time to see the error:
$ yarn install yarn install v0.28.1 error There are more than one workspace with name "ramda" info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
What is the expected behavior?
There should not be a problem doing a second yarn install.
Extra Info
The problem I think is simply that Yarn is looking in node_modules folders to determined workspaces. For example, with the pattern packages/**/*, and with the tree:
├── node_modules
├── package.json
├── packages
│ ├── a
│ │ └── package.json
│ ├── b
│ │ ├── node_modules
│ └── ramda
│ │ └── package.json
│ └── c
│ ├── node_modules
│ └── ramda
│ └── package.json
└── yarn.lock
Yarn is finding packages/b/nodes_modules/ramda and packages/c/nodes_modules/ramda as being a valid workspace while it's a simple dependency.
Please mention your node.js, yarn and operating system version.
Yarn 0.28.1
Node 7.9
Mac OS X