Skip to content

Instantly share code, notes, and snippets.

@robwierzbowski
Last active September 28, 2024 20:24
Show Gist options
  • Save robwierzbowski/9fdf661341ec99c3ea0f480f99ac2ea5 to your computer and use it in GitHub Desktop.
Save robwierzbowski/9fdf661341ec99c3ea0f480f99ac2ea5 to your computer and use it in GitHub Desktop.
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