0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/website/versioned_docs/version-5.x/setup-yarn.md
Juan Picado 3d158a195a
chore(website): plugin search ui (#3539)
* chore: plugin search ui

chore: progress

chore: format code

chore: progress

chore: @verdaccio-ui/copy-clipboard

chore: search finish

* chore: ui-components

* Update ToolList.tsx

* xss protection

* Update static-data.yml

* Update AddonCard.tsx
2022-12-25 18:48:18 +01:00

2.1 KiB

id title
setup-yarn yarn

yarn

yarn classic (1.x)

Be aware .npmrc file configuration is recognized by yarn classic.

The classic version is able to regonise the .npmrc file, but also provides their own configuration file named .yarnrc.

To set up a registry, create a file and define a registry.

// .yarnrc
registry "http://localhost:4873"

yarn@1.x by default does not send the token on every request unless is being opt-in manually, this might causes 403 error if you have protected the access of your packages.

To change this behaviour enable always-auth in your configuration :

always-auth=true

or running

npm config set always-auth true

yarn modern (>=2.x)

Yarn modern does not recognize --registry or .npmrc file anymore.

For defining a registry you must use the .yarnrc.yml located in the root of your project or global configuration.

When you publish a package the npmRegistryServer must be used. Keep in mind the publishConfig.registry in the package.json will override this configuration.

// .yarnrc.yml
npmRegistryServer: "http://localhost:4873"

unsafeHttpWhitelist:
  - localhost

unsafeHttpWhitelist is only need it if you don't use https with a valid certificate.

Using scopes is also possible and more segmented, you can define a token peer scope if is required.

npmRegistries:
  "https://registry.myverdaccio.org":
    npmAlwaysAuth: true
    npmAuthToken: <TOKEN>
npmScopes:
  my-company:
    npmRegistryServer: https://registry.myverdaccio.org
    npmPublishRegistry: https://registry.myverdaccio.org

for logging via CLi use:

yarn npm login --scope my-company

Troubleshooting

Known issues