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

Not able to publish the package to npm. #321

Open
nalnir opened this issue Sep 8, 2023 · 3 comments
Open

Not able to publish the package to npm. #321

nalnir opened this issue Sep 8, 2023 · 3 comments

Comments

@nalnir
Copy link

nalnir commented Sep 8, 2023

Using github actions.
My publish.yaml looks like this:

name: "Publish"
on:
  push:
    branches: 
      - "main"

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: pnpm/action-setup@v2
        with:
          version: 7
      - uses: actions/setup-node@v3
        with: 
          node-version: 16.x
          cache: "pnpm"

      - run: pnpm install --frozen-lockfile
      - name: Create Release Pull Request or Publish 
        id: changesets
        uses: changesets/action@v1
        with: 
          publish: pnpm run publish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

When I push the changes to githug the release action is successful but I get this message:

"body": "This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.\n\n\n# Releases\n## @crypties/arcane-blessings@0.0.3\n\n### Patch Changes\n\n- 052b371: Initial publish\n",

When I merge the PR then I get the errror:

setting git user
/usr/bin/git config user.name "github-actions[bot]"
/usr/bin/git config user.email "github-actions[bot]@users.noreply.github.com"
setting GitHub credentials
No changesets found, attempting to publish any unpublished packages to npm
No user .npmrc file found, creating one
/home/runner/setup-pnpm/node_modules/.bin/pnpm run publish
 ERR_PNPM_NO_SCRIPT  Missing script: publish

Command "publish" not found.
Error: Error: The process '/home/runner/setup-pnpm/node_modules/.bin/pnpm' failed with exit code 1
Error: The process '/home/runner/setup-pnpm/node_modules/.bin/pnpm' failed with exit code 1
@nalnir
Copy link
Author

nalnir commented Sep 9, 2023

Ok, had some issues in my yaml. First of all: jobs: build: should be jobs: publish second my pnpm script: pnpm publish had a type and instead of changeset publish I had changesets publish so I fixed that as well. However now I'm getting 404 error:

info npm info @crypties/arcane-blessings
🦋  warn Received 404 for npm info "@crypties/arcane-blessings"
🦋  info @crypties/arcane-blessings is being published because our local version (0.0.6) has not been published on npm
🦋  info Publishing "@crypties/arcane-blessings" at "0.0.6"
🦋  error an error occurred while publishing @crypties/arcane-blessings: E404 Not Found - PUT https://registry.npmjs.org/@crypties%2farcane-blessings - Scope not found 
🦋  error 
🦋  error  '@crypties/arcane-blessings@0.0.6' is not in this registry.
🦋  error 
🦋  error Note that you can also install from a
🦋  error tarball, folder, http url, or git url.
🦋  error npm notice Publishing to https://registry.npmjs.org/
🦋  error npm ERR! code E404
🦋  error npm ERR! 404 Not Found - PUT https://registry.npmjs.org/@crypties%2farcane-blessings - Scope not found
🦋  error npm ERR! 404 
🦋  error npm ERR! 404  '@crypties/arcane-blessings@0.0.6' is not in this registry.
🦋  error npm ERR! 404 
🦋  error npm ERR! 404 Note that you can also install from a
🦋  error npm ERR! 404 tarball, folder, http url, or git url.
🦋  error {
🦋  error   "error": {
🦋  error     "code": "E404",
🦋  error     "summary": "Not Found - PUT https://registry.npmjs.org/@crypties%2farcane-blessings - Scope not found",
🦋  error     "detail": "\n '@crypties/arcane-blessings@0.0.6' is not in this registry.\n\nNote that you can also install from a\ntarball, folder, http url, or git url."
🦋  error   }
🦋  error }
🦋  error 
🦋  error npm ERR! A complete log of this run can be found in:
🦋  error npm ERR!     /home/runner/.npm/_logs/2023-09-09T02_[51](https://github.com/nalnir/arcane-blessings/actions/runs/6128491180/job/16635592502#step:6:52)_06_182Z-debug-0.log
🦋  error 
🦋  error packages failed to publish:
🦋  @crypties/arcane-blessings@0.0.6
 ELIFECYCLE  Command failed with exit code 1.
Error: Error: The process '/home/runner/setup-pnpm/node_modules/.bin/pnpm' failed with exit code 1
Error: The process '/home/runner/setup-pnpm/node_modules/.bin/pnpm' failed with exit code 1

I have NPM_TOKEN set in my Github, but I am not able to set my GITHUB_TOKEN becuase github does not allow token name that starts with GITHUB_

@nalnir
Copy link
Author

nalnir commented Sep 9, 2023

So I just changed the name for GITHUB_TOKEN and instead in my publish.yaml I have it like this: GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}

But the error is still 404. I don't know what am I suppose to do now

@MikelArnaiz
Copy link

GITHUB_TOKEN is already provided by GitHub, you don't have to add it to your secrets, you can just use it

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Token automatically added by Github

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants