Skip to content

Generators don't work when using pnpm catalogs #29772

Open
@comp615

Description

Current Behavior

Running the example code:
nx g plugin my-plugin --directory=libs --importPath=@squareup/my-plugin

yields:
Error: The package.json lists a version of typescript that Nx is unable to validate - (catalog:)

This is because the generators use a check of the TS version which simply gets the entry from package.json and does not resolve catalogs from pnpm:

async function getInstalledTypescriptVersion(

Expected Behavior

A helper should be employed in the various places NX tries to resolve a version string from the package.json to resolve the "real" version using pnpm for checks like this to enable fuller support for pnpm as the package manager.

GitHub Repo

No response

Steps to Reproduce

package.json:

"devDependencies": {
    "typescript": "catalog:",
}

pnpm-workspace.yaml:

catalog:
  typescript: ~5.5.2

Nx Report

NX   Report complete - copy this into the issue template

Node           : 22.9.0
OS             : darwin-arm64
Native Target  : aarch64-macos
pnpm           : 9.11.0

nx                     : 20.3.2
@nx/js                 : 20.3.2
@nx/jest               : 20.3.2
@nx/eslint             : 20.3.2
@nx/workspace          : 20.3.2
@nx/cypress            : 20.3.2
@nx/devkit             : 20.3.2
@nx/eslint-plugin      : 20.3.2
@nx/module-federation  : 20.3.2
@nx/plugin             : 20.3.2
@nx/react              : 20.3.2
@nx/storybook          : 20.3.2
@nx/vite               : 20.3.2
@nx/web                : 20.3.2
typescript             : 5.5.4
---------------------------------------
Registered Plugins:
@nx/vite/plugin
@nx/storybook/plugin

Failure Logs

Package Manager Version

9.11.0

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions