Aqeel Raiee
Aqeel Raiee

Reputation: 11

Why does my private GitLab package return "404 Not Found" when trying to install it in a monorepo using pnpm?

I am working on a monorepo project using nx and pnpm. The project contains multiple packages, including @my-org/package1 and @my-org/package2. I have set up a private GitLab package registry to publish and install these packages.

Here’s the workflow:

  1. I published the @my-org/package2 package successfully to the private registry. Now, I want to use @my-org/package2 as a dependency in the @my-org/package1 package for local development.

  2. However, when I try to install the package in the @my-org/package1 project using pnpm, I get the following error:

404 Not Found: @my-org/package2
  1. Registry Configuration:
    I added the following to my .npmrc file:

    @my-org:registry=https://gitlab.com/api/v4/projects/<project-id>/packages/npm/
    //gitlab.com/api/v4/projects/<project-id>/packages/npm/:_authToken=<my-token>
    always-auth=true
    
  2. Verified the Package:
    I ran pnpm view @my-org/package2, and it shows the package with the correct version in the registry.

  3. Local Linking:
    I tried using workspace in pnpm-workspace.yaml:

    packages:
      - 'packages/*'
    

    And added this dependency in @my-org/package1’s package.json:

    "dependencies": {
      "@my-org/package2": "^0.0.1"
    }
    
  4. Cleared Cache:
    I ran pnpm store prune and reinstalled all dependencies.

Environment Details

Questions

  1. Why am I seeing a 404 error for the package, even though it is published and visible in the registry?

  2. How can I set up my monorepo to use the @my-org/package2 package in @my-org/package1 for local development without this issue?

Upvotes: 1

Views: 56

Answers (0)

Related Questions