Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yarn: How to specify the path of the package.json file

With NPM you can sudo npm --prefix /var/www... to specify the path of a package.json file.

How can you achieve this with Yarn? I can't seem to find the answer.

Thanks.

like image 968
Cazineer Avatar asked Jun 26 '18 07:06

Cazineer


People also ask

How do I change the directory of my yarn?

The output directory can be changed by running yarn with the command line option --modules-folder . For example, if you wanted to install packages into a web/vendor directory instead of node_modules , you would add the modules-folder option on all yarn commands like yarn install --modules-folder web/vendor .

Does yarn create a package json file?

Whenever you run the yarn init command, the package. json file will be created.

Does yarn install from package json?

Install all the dependencies listed within package. json in the local node_modules folder.


1 Answers

To run yarn command from any folder, you should specify path to working directory after --cwd. So to run yarn build for specific path you should run

yarn --cwd <path> build
like image 117
Eugene Avatar answered Oct 24 '22 19:10

Eugene