Github Actions. Ошибка 403 при публикации на npm

publish.yml

name: Publish package to npm

# trigger this workflow only when commits are pushed to master branch
on:
  push:
    branches:
      - master

jobs:
  # build is the job name (could be anything)
  build:
    runs-on: ubuntu-latest

    steps:
      # move repository files to workflow environment
      - uses: actions/checkout@v2

      # Setup .npmrc file to publish to npm
      - uses: actions/setup-node@v2
        with:
          node-version: '16.x'
          registry-url: 'https://registry.npmjs.org'

      # make build
      - run: yarn
      - run: yarn lint
      - run: yarn build

      # publish to npm
      - run: npm publish --access public
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Токен (CI/CD) установлен в разделе secrets в репозитории.

package.json

{
  "name": "@my-scope/my-package",
  "version": "0.0.1",
  "main": "lib/index.js",
  "license": "MIT",
  "type": "module",
  "files": [
    "lib/**/*"
  ],
  "exports": "./lib/index.js",
  "types": "./lib/index.d.ts",
  "scripts": {
    "build": "tsc",
    "lint": "eslint . --fix"
  },
  "devDependencies": {
    "@types/node": "^17.0.41",
    "@typescript-eslint/eslint-plugin": "^5.27.1",
    "@typescript-eslint/parser": "^5.27.1",
    "prettier": "^2.6.2",
    "typescript": "^4.7.3"
  },
  "dependencies": {
    "chalk": "^5.0.1",
    "eslint": "^8.17.0"
  }
}

@my-scope - область существует. Но публикация падает с ошибкой

npm notice Publishing to https://registry.npmjs.org/
npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/@my-scope%2fmy-package - You may not perform that action with these credentials.
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.

Ответы (0 шт):