I'm trying to publish package to NPM using github action.
YML file
name: Publish to NPM
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Check out the repo'
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: 'Install Node.js'
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
# Defaults to the user or organization that owns the workflow file
scope: '@org'
- name: Install dependencies
run: npm ci
- name: Build the package
run: npm run build
- run: npm config set "//registry.npmjs.org/:_authToken" "\${NODE_AUTH_TOKEN}" --location=project
- name: Publish package on NPM
run: npm publish --access public --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npm config delete "//registry.npmjs.org/:_authToken" --location=project
if: always()
NPM_TOKEN has been added at org level in repo.
When running this, getting the following error:
npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/@org%2fpackage - Not found
npm ERR! 404
npm ERR! 404 '@@org%/package@0.0.0' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
Following step taken to resolve this:
- Try with personal token with automate rights, still the same error.
If anyone can guide me to right direction, that would be great. Thanks
Trying to successfully publish package to NPM registry.