Skip to content

Use of corepack "packageManager" breaks npm run local-registry start #4024

Closed

Description

@geometryzen

Current Behavior

Running

npn run local-registry start

fails with the following output:

Starting Local Registry
error This project's package.json defines "packageManager": "yarn@[email protected]". However the current global version of Yarn is 1.22.22.

Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.

Expected Behavior

The local registry should start listening on port 4873.

This is a regression. An addition was made to package.json recently in which "packageManager" was added.

Removing the "packageManager" field is a workaround.

Environment

Ubuntu 24.04

Activity

  1. JamesHenry commented on Jun 24, 2024

    @JamesHenry
    Member

    Is yarn@[email protected] a typo?

    We do use corepack in github workflows, so that's why we need the packageManager field.

    I cannot reproduce any issue with starting the registry locally I'm afraid.

    Please can you dig a little deeper into your environment and what might be causing it?

    Here is my lerna info output for you to compare as a starting point:

    ❯ npx lerna info
    lerna notice cli v8.1.5
    
     Environment info:
    
      System:
        OS: macOS 14.5
        CPU: (16) arm64 Apple M3 Max
      Binaries:
        Node: 20.14.0 - ~/.volta/tools/image/node/20.14.0/bin/node
        Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
        npm: 10.7.0 - ~/.volta/tools/image/npm/10.7.0/bin/npm
      Utilities:
        Git: 2.39.3 - /usr/bin/git
      npmPackages:
        lerna: file:packages/lerna => 8.1.5 
    
  2. geometryzen commented on Jun 25, 2024

    @geometryzen
    ContributorAuthor

    And here is mine...

    Environment info:

    System:
    OS: Linux 6.8 Ubuntu 24.04 LTS 24.04 LTS (Noble Numbat)
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
    Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    Yarn: 1.22.22 - ~/.yarn/bin/yarn
    npm: 10.8.1 - ~/.nvm/versions/node/v20.12.2/bin/npm
    Utilities:
    Git: 2.43.0 - /usr/bin/git
    npmPackages:
    lerna: file:packages/lerna => 8.1.5

  3. geometryzen commented on Jun 25, 2024

    @geometryzen
    ContributorAuthor

    I've just pulled your recent changes on main onto a clean lerna codebase (meaning none of my changes).

    As before, when I run...

    npm run local-registry start

    I get the following:

    local-registry
    tools/scripts/local-registry.sh start

    Starting Local Registry
    error This project's package.json defines "packageManager": "yarn@[email protected]". However the current global version of Yarn is 1.22.22.

    Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
    Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.

    The first few line of package.json are

    {
    "name": "lerna-monorepo",
    "private": true,
    "description": "lerna dog-fooding lerna",
    "workspaces": [
    "packages/*",
    "packages/legacy-structure/commands/create"
    ],
    "volta": {
    "node": "20.14.0",
    "yarn": "1.22.19",
    "npm": "10.7.0"
    },
    "packageManager": "[email protected]",
    "engines": {

    Removing the "packageManager" property allows the registry to start and run...

    Starting Local Registry
    yarn run v1.22.22
    $ /home/david/Development/lerna/node_modules/.bin/verdaccio --config ./.verdaccio/config.yml
    (node:22646) [VERWAR002] VerdaccioWarning: The configuration property "logs" has been deprecated, please rename to "log" for future compatibility
    (Use node --trace-warnings ... to show where the warning was created)
    info --- config file - /home/david/Development/lerna/.verdaccio/config.yml
    info --- the "crypt" algorithm is deprecated consider switch to "bcrypt" in the configuration file. Read the documentation for additional details
    info --- using htpasswd file: /home/david/Development/lerna/.verdaccio/htpasswd
    info --- plugin successfully loaded: verdaccio-htpasswd
    warn --- http address - http://localhost:4873/ - verdaccio/5.31.1

    I'll do some digging here.

  4. geometryzen commented on Jun 25, 2024

    @geometryzen
    ContributorAuthor

    I've just found this...

    yarnpkg/yarn#9015

    I don't think volta is doing it's job on my system.

  5. geometryzen commented on Jun 25, 2024

    @geometryzen
    ContributorAuthor

    I have verified that the issue was caused by a global version of yarn that was preventing volta from pinning the version of yarn to "1.22.19". In fact, the issue can be reproduced by changing the version of yarn to "1.22.22".
    Closing the issue as an environment setup error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions