cat-featuregood first issuehelp wantedtriaged
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
yarn add --cwd invalid-dir bluebird installs bluebird to the root:
yarn add v1.3.2
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
└─ bluebird@3.5.1
✨ Done in 0.30s.
If the current behavior is a bug, please provide the steps to reproduce.
Just yarn add --cwd invalid-dir bluebird (and invalid-dir not exist, of course)
What is the expected behavior? Throw an error, or at least show a warning.
For reference, on npm 5.6.0, npm --prefix invalid-dir bluebird creates invalid-dir and installs it there (which I also think is unexpected behavior), but at least it throws a warning:
$ npm i --prefix invalid-dir bluebird
npm WARN saveError ENOENT: no such file or directory, open '/Users/marvin/devel/yarn-add-cwd-demo/invalid-dir/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/Users/marvin/devel/yarn-add-cwd-demo/invalid-dir/package.json'
npm WARN invalid-dir No description
npm WARN invalid-dir No repository field.
npm WARN invalid-dir No README data
npm WARN invalid-dir No license field.
+ bluebird@3.5.1
added 1 package in 0.734s
Please mention your node.js, yarn and operating system version. node v8.9.4, yarn 1.3.4, macOS High Sierra 10.13.2