Setting up GitHub Personal Access Tokens for local development

Private NPM Package Requirements

In order to utilize your private GitHub NPM package you're going to need two things:

  1. A GitHub Personal Access token setup and configured for your local machine (steps below)
  2. A new file: .npmrc which will live right next to your package.json in your project repo (the codebase you're implementing your design system in). The exact file contents below:

Generating your token

  1. You will need to add an env variable of $GITHUB_TOKEN in order to install your private NPM package @knapsack-cloud/[YOUR-PRIVATE-PACKAGE] in your project.
  2. If you run echo $GITHUB_TOKEN and do not see anything — you haven't setup your env variable
  3. Generate your token via this doc


  1. Add export GITHUB_TOKEN="[MY TOKEN HERE]" (no square brackets or quotes) inside either your .bash_profile , .bashrc , or .zshrc (you will need to source that file afterwards or completely restart the terminal)
  2. Open a new terminal and run echo $GITHUB_TOKEN again to verify you see your token (if you do not you will need to close your terminal and re-open it OR source the .bash_profile , .bashrc , or .zshrc file)
  3. Now you can yarn install / npm install


NOTE: For Windows users, we must add the environmental variable through system configuration screens.

  1. Open System Environment Variables
  2. Under the System Properties, navigate to the Advanced tab and click the bottom Environmental Variables button

  3. Next, in the System variables section — click the New button

  4. For "Variable name" use "GITHUB_TOKEN" (no quotes)

  5. For Variable value — paste the token you received from step 3 of the first section above.
  6. Click OK
  7. Important: restart your computer
  8. When the system comes back up – open Windows PowerShell and type this command: $env:GITHUB_TOKEN — you should see your personal access token!
  9. Now you can yarn install / npm install