How to fix npm ERR! code E404 npm ERR! 404 Not Found - GET https://npm.pkg.github.com/@org/package in npm

npmINTERMEDIATEMEDIUMUpdated Dec 7, 2025· 168 views

This error occurs when npm can't find a package on GitHub Packages registry. Usually an authentication issue—GitHub Packages returns 404 instead of 401 to hide whether private packages exist.

Quick fix

Fixes npm ERR! code E404 npm ERR! 404 Not Found - GET https://npm.pkg.github.com/@org/package

//npm.pkg.github.com/:_authToken=YOUR_PERSONAL_ACCESS_TOKEN
@YOUR-ORG:registry=https://npm.pkg.github.com
  1. Create a Personal Access Token
  2. Configure .npmrc for authentication
  3. Use environment variable (recommended for CI/CD)
  4. Configure GitHub Actions
npm — error
//npm.pkg.github.com/:_authToken=YOUR_PERSONAL_ACCESS_TOKEN
@YOUR-ORG:registry=https://npm.pkg.github.com
npm ERR! code E404
npm ERR! 404 Not Found - GET https://npm.pkg.github.com/@org/package

What this error means

GitHub Packages is GitHub's npm registry for hosting private and public packages. Unlike the main npm registry, GitHub Packages requires authentication even for public packages. The tricky part: GitHub returns a 404 error instead of 401 when authentication fails. This is intentional—it prevents unauthorized users from discovering whether private packages exist. So when you see "404 Not Found," the package usually does exist; you just don't have proper authentication configured. This error is extremely common when setting up GitHub Packages for the first time or in CI/CD pipelines.

Typical symptoms

  • npm install fails with 'E404' or '404 Not Found'
  • Error URL contains 'npm.pkg.github.com'
  • Package exists on GitHub but npm can't find it
  • Works for some team members but not others
  • Fails in CI/CD with 404 error

Common causes

  1. Missing Personal Access Token (PAT) for authentication
  2. No .npmrc file configured for GitHub Packages registry
  3. PAT doesn't have 'read:packages' scope
  4. Using GITHUB_TOKEN which can't access other repositories
  5. Scoped package name doesn't match GitHub organization
  6. Package genuinely not published to GitHub Packages

How to fix "npm ERR! code E404 npm ERR! 404 Not Found - GET https://npm.pkg.github.com/@org/package"

1Create a Personal Access Token

Generate a PAT with package read access:

1. Go to GitHub → Settings → Developer settings → Personal access tokens
2. Click "Generate new token (classic)"
3. Select scopes: read:packages, repo (for private repos)
4. Copy the token immediately (you won't see it again)

2Configure .npmrc for authentication

Create or edit ~/.npmrc in your home directory:

bash
//npm.pkg.github.com/:_authToken=YOUR_PERSONAL_ACCESS_TOKEN
@YOUR-ORG:registry=https://npm.pkg.github.com

Replace:
- YOUR_PERSONAL_ACCESS_TOKEN with your PAT
- YOUR-ORG with your GitHub organization or username

Important: The scope (@YOUR-ORG) must match the package scope exactly.

3Use environment variable (recommended for CI/CD)

For better security, use an environment variable:

bash
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
@YOUR-ORG:registry=https://npm.pkg.github.com

Then set NODE_AUTH_TOKEN in your environment or CI/CD secrets.

4Configure GitHub Actions

For GitHub Actions, use the built-in setup:

yaml
- uses: actions/setup-node@v4
  with:
    node-version: '20'
    registry-url: 'https://npm.pkg.github.com'
    scope: '@your-org'

- run: npm ci
  env:
    NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Note: GITHUB_TOKEN only works for packages in the same repository. For cross-repo packages, use a PAT stored in secrets.

5Verify configuration

Check your npm configuration:

bash
npm config get @your-org:registry
# Should show: https://npm.pkg.github.com

npm config list
# Verify no conflicting settings

Advanced notes

GITHUB_TOKEN Limitations: The built-in GITHUB_TOKEN in GitHub Actions can only access packages from the same repository. For packages from other repos in your organization, you need a Personal Access Token with read:packages scope.

Public Packages Still Need Auth: Unlike npmjs.com, GitHub Packages requires authentication even for public packages. This is a common surprise.

Repository Field: Packages must have a repository field in package.json matching the GitHub repo where they're published:

json
{
  "repository": {
    "type": "git",
    "url": "https://github.com/your-org/your-repo.git"
  }
}

Multiple Registries: You can use both npm and GitHub Packages by scoping:

bash
@your-org:registry=https://npm.pkg.github.com
registry=https://registry.npmjs.org

Frequently asked questions

What does "npm ERR! code E404 npm ERR! 404 Not Found - GET https://npm.pkg.github" mean?
GitHub Packages is GitHub's npm registry for hosting private and public packages. Unlike the main npm registry, GitHub Packages requires authentication even for public packages. The tricky part: GitHub returns a 404 error instead of 401 when authentication fails.
How do I fix "npm ERR! code E404 npm ERR! 404 Not Found - GET https://npm.pkg.github"?
This error occurs when npm can't find a package on GitHub Packages registry. Usually an authentication issue—GitHub Packages returns 404 instead of 401 to hide whether private packages exist.
What causes "npm ERR! code E404 npm ERR! 404 Not Found - GET https://npm.pkg.github"?
Missing Personal Access Token (PAT) for authentication No .npmrc file configured for GitHub Packages registry PAT doesn't have 'read:packages' scope
Is the "npm ERR! code E404 npm ERR! 404 Not Found - GET https://npm.pkg.github" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading