yarnpkg/yarn
View on GitHub`yarn add` with workspaces doesn't install to workspace root
Open
#4,513 opened on Sep 21, 2017
cat-bughelp wantedhigh-prioritytriaged
Description
Do you want to request a feature or report a bug? bug
What is the current behavior?
Running yarn add foo inside a workspace directory does two unexpected things;
- it installs the newly added dependency in
/my-workspace/node_modules/foo, whereas I would expect it to install it to the workspace root, e.g.:/node_modules/foo - it installs all other dependencies of
my-workspaceto/my-workspace/node_modules
If the current behavior is a bug, please provide the steps to reproduce. See also: https://github.com/edorivai/workspace-test
- Create an empty directory(
workspace-1), and add a minimalpackage.jsonfile. - In root
package.json, set"workspaces": [ "./*" ] - Run:
cd workspace-1
yarn add lodash.assign
- By now, I'd have (also see screenshot)
/workspace-1
/node_modules
/lodash.assign
What is the expected behavior? I would have expected
/node_modules
/lodash.assign
/workspace-1
With node modules being installed at the root level.
Please mention your node.js, yarn and operating system version.
$ uname -srvo
Linux 4.4.0-93-generic #116-Ubuntu SMP Fri Aug 11 21:17:51 UTC 2017 GNU/Linux
$ lsb_release -rcd
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
$ node --version
v8.5.0
$ npm --version
5.3.0
$ yarn --version
1.0.2-20170921.1145