Skip to content

Publish not working for internal Artifactory registry #336

Description

@brad-mccormick

In my GitHub Workflow I'm creating a .npmrc with connection info for our internal Artifactory registry and then executing the changesets action. It fails on running the pnpm changesets publish command with an "incorrect or missing password" and to run npm login. The documentation states that in the presence of a .npmrc, that user defined registry info is used instead. So why does it seem that its failing to use it and expecting an NPM_TOKEN? Here's an excerpt from the failed workflow:

No changesets found, attempting to publish any unpublished packages to npm
Found existing user .npmrc file
Didn't find existing auth token for the npm registry in the user .npmrc file, creating one
/home/runner/setup-pnpm/node_modules/.bin/pnpm run changeset:release 

Activity

  1. MikelArnaiz commented on Dec 14, 2023

    @MikelArnaiz

    Provide an example of your .npmrc file

  2. uiolee commented on Jan 19, 2024

    @uiolee

    same issue

  3. uiolee commented on Jan 19, 2024

    @uiolee

    return /^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line);

    Didn't find existing auth token for the npm registry in the user .npmrc file, creating one

    the code just check npmjs token, which is the problem

  4. nikparo commented on Jan 27, 2024

    @nikparo

    I got a similar error in a monorepo using pnpm (You need to authorize this machine using npm adduser), and in my case it was because I had defined a publish script in package.json, which I tried running in the changeset action as pnpm publish. The problem is that publish is a built in command, so to run the script you would need pnpm run publish. I opted to rename the script instead.

    package.json:

    {
      "scripts": {
    -    "publish": "pnpm build && pnpm changeset publish",
    +    "publish-changeset": "pnpm build && pnpm changeset publish",
      }
    }

    .github/workflows/release.yaml:

          - name: "Create Release Pull Request or Publish to GCP"
            id: changesets
            uses: changesets/action@v1
            with:
    -          publish: pnpm publish
    +          publish: pnpm publish-changeset
            env:
              GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  5. vsnig commented on May 28, 2025

    @vsnig

    I found a workaround, see this
    They set the registry in the script
    And authenticate in the workflow
    Just tried and it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions