Yarn: Yarn global add current directory

Created on 9 Jan 2018  路  7Comments  路  Source: yarnpkg/yarn

In npm, I can run npm i -g to take the package in the current folder and install it globally. This is really useful when working on CLIs because you can install it globally on your machine and try it out before publishing to npm. When I run yarn global add with no further parameters, it doesn't seem to do anything. Is there an equivalent command for yarn?

triaged

Most helpful comment

Give this a try:

yarn global add file:$PWD

references:
https://yarnpkg.com/en/docs/cli/add

2291

All 7 comments

Give this a try:

yarn global add file:$PWD

references:
https://yarnpkg.com/en/docs/cli/add

2291

That seems to work, relative path name support would help, as would documentation improvements, but it does seem to work.

Thanks!

Well, either I did something wrong or there is a bug. Yarn tries to connect to the npm registry and throws a 405 error.

Use the absolute path, cuz the relative path used by yarn global is (in Windows case) Appdata, and you have to use the absolute path to specify your project folder to be global.

Use the absolute path, cuz the relative path used by yarn global is (in Windows case) Appdata, and you have to use the absolute path to specify your project folder to be global.

I can use pwd in Git Bash so this is not the issue here ;-)

I dont use Git bash, I use cmd and for me use the absolute path woking 馃槃 Greetings

This works on Git Bash for Windows: yarn global add $PWD

Was this page helpful?
0 / 5 - 0 ratings