Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Configure yarn to use the npm registry directly
#!/bin/bash
# Remove all settings in the .npmrc except the required auth token setting.
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
# Create a new .yarnrc that specifies the npm registry, or append to an existing one.
echo 'registry: https://registry.npmjs.org/' >> .yarnrc
# Remove and regenerate the yarn.lock. This should be identical to running `yarn upgrade`.
# If you are uncomfortable regenerating the yarn.lock file, you can comment out the next
# two lines and try manually finding and replacing 'https://registry.yarnpkg.com/' with
# 'https://registry.npmjs.org/'
rm yarn.lock
yarn
# You can check that the registry has been set correctly by running `yarn config list`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment