Skip to content

Instantly share code, notes, and snippets.

@robwierzbowski
Last active July 19, 2025 09:42
Show Gist options
  • Select an option

  • Save robwierzbowski/9fdf661341ec99c3ea0f480f99ac2ea5 to your computer and use it in GitHub Desktop.

Select an option

Save robwierzbowski/9fdf661341ec99c3ea0f480f99ac2ea5 to your computer and use it in GitHub Desktop.

Revisions

  1. robwierzbowski revised this gist Sep 23, 2020. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions switch_to_npm_registry.sh
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,9 @@ echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
    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

  2. robwierzbowski created this gist Sep 23, 2020.
    13 changes: 13 additions & 0 deletions switch_to_npm_registry.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    #!/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`.
    rm yarn.lock
    yarn

    # You can check that the registry has been set correctly by running `yarn config list`.