mrbnetworks
mrbnetworks

Reputation: 2627

Run yarn in a different path

Is there a way to specify a working directory for yarn? This would be different then the --modules-folder option. Specifically, I'm trying to run the yarn install command from a location outside of the package location.

Similar to -C in git

Upvotes: 153

Views: 111434

Answers (2)

madav
madav

Reputation: 3086

You can use --cwd like so yarn --cwd <path> <yarn command>.
The order of arguments is important.

Example:

yarn --cwd ~/test_project/ dev

Because the following will not work:

yarn dev --cwd ~/test_project/

Upvotes: 260

Tim Green
Tim Green

Reputation: 3649

--cwd is what you want.

(tested with yarn 1.3.2)

Upvotes: 155

Related Questions