add this on package.json
"publishConfig": {
"access": "public"
},
to publish need to have install with npm i
# if dont have the package-lock.json
npm i --legacy-peer-deps
# if have the package-lock.json
npm ci --legacy-peer-deps
to publish
npm publish --access=public --legacy-peer-deps
and need to have the package-lock.json to with github action
name: Publish to NPM
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies 🔧
run: npm i --legacy-peer-deps
- name: Publish package on NPM 📦
run: npm publish --access=public --legacy-peer-deps
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}