yarn icon indicating copy to clipboard operation
yarn copied to clipboard

No `npm root` equivalent

Open lukebatchelor opened this issue 9 years ago • 3 comments

I'm not sure if this is expected or not, but I cant seem to find an equivalent to the npm root command for yarn. Feel free to close if this is expected. 👍

Do you want to request a feature or report a bug? feature (could be considered a bug if yarn wants to be as much of a drop in replacement for npm as possible? I assume it's not though)

What is the current behavior? error Command "root" not found.

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

What is the expected behavior? yarn should output the path to the node_modules folder

Please mention your node.js, yarn and operating system version. yarn 0.17.10 npm 3.9.5 OSX 10.11.4

lukebatchelor avatar Jan 05 '17 02:01 lukebatchelor

We'd also like this because we use npm root to find the root directory to add .bin to our path inside shell scripts.

PATH="$(git rev-parse --show-toplevel)/tools":"$(npm root)/.bin":$PATH

esprehn avatar Feb 22 '18 03:02 esprehn

Also, npm root -g gives the location of the global node_modules folder (which may be platform-dependant and npm-version-dependant). I assume the corresponding yarn command would be yarn global root.

snajjar avatar Feb 15 '19 13:02 snajjar

@snajjar and yet, there's no such command yarn global root.

is it $(yarn global dir)/node_modules?

chardskarth avatar Aug 25 '22 01:08 chardskarth