Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Npm public login require but new bug #974

Closed
plsgivemeachane opened this issue Feb 27, 2024 · 6 comments
Closed

Npm public login require but new bug #974

plsgivemeachane opened this issue Feb 27, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@plsgivemeachane
Copy link

plsgivemeachane commented Feb 27, 2024

npm notice === Tarball Details ===
npm notice name: @quanvndev/waterx
npm notice version: 1.0.5
npm notice filename: @quanvndev/waterx-1.0.5.tgz
npm notice package size: 129.4 kB
npm notice unpacked size: 525.8 kB
npm notice shasum: 8edca9b93551a8d8806cace4fdeea3734f9683a5
npm notice integrity: sha512-8a4WKePggCg3l[...]zvROWUZgv8gpg==
npm notice total files: 32
npm notice
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in to https://registry.npmjs.org/
npm ERR! need auth You need to authorize this machine using npm adduser

npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/logs/2024-02-27T01_2058_187Z-debug-0.log
Error: Process completed with exit code 1.
Description:
Github actions bug need login when already pass through the GITHUB_ACTION token
already read other duppilcate closed issue

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package

on:
  release:
    types: [created]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 16
      - run: npm ci
      - run: npm test

  publish-gpr:
    needs: build
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 16
          registry-url: https://npm.pkg.github.com/
      - run: npm ci
      - run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
@plsgivemeachane plsgivemeachane added bug Something isn't working needs triage labels Feb 27, 2024
@HarithaVattikuti
Copy link
Contributor

Hello @plsgivemeachane
Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

@gowridurgad
Copy link

gowridurgad commented Mar 19, 2024

Hi @plsgivemeachane, we've conducted a test on our end using an auth token to publish the registry, and it completed without any errors. Here's a screenshot for your reference. Could you please verify if you're using the correct auth token with the necessary publishing permissions?
Image 20-03-24 at 8 18 PM

@plsgivemeachane
Copy link
Author

plsgivemeachane commented Mar 19, 2024

Hi @plsgivemeachane, we've conducted a test on our end using an auth token to publish the registry, and it completed without any errors. Here's a screenshot for your reference. Could you please verify if you're using the correct auth token with the necessary publishing permissions?

Image 20-03-24 at 8 18 PM

I thought that the github token are created in runtime, isn't it?

@gowridurgad
Copy link

I thought that the github token are created in runtime, isn't it?

To publish npm in our GitHub registry, we may follow one of two methods:

  1. Generate a token from the official npm website and assign it to secrets.NPM_TOKEN. At runtime, GITHUB_TOKEN will be created using the access provided from npm.
    env:
    NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
  • uses: actions/setup-node@v4
    with:
    registry-url: 'https://npm.pkg.github.com/'
  • run: npm publish
    env:
    NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  1. If we prefer to publish through our GitHub repository, we need to create a secret with the access token of our repository.
    steps:
  • uses: actions/checkout@v3
  • uses: actions/setup-node@v3
    with:
    node-version: 16
    registry-url: https://npm.pkg.github.com/
  • run: npm install
  • run: npm publish
    env:
    NODE_AUTH_TOKEN: ${{secrets.GIT_TOKEN}}
    In both cases, the NODE_AUTH_TOKEN is used in the environment for authentication.

@gowridurgad
Copy link

Hello @plsgivemeachane
Just a gentle reminder!

@gowridurgad
Copy link

Hello @plsgivemeachane,
Due to inactivity, I'm going to close this issue for now. Please feel free to reopen this issue or create a new one if necessary. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants