Skip to content

Add support for the workspace: protocol #173

Closed
@goestav

Description

@goestav

I'm using a PNPM workspace for my project but when I use the workspace: protocol with the pnpm attw --pack . command I get the following error:

error while checking file:
Command failed: npm pack

Running npm pack manually reveals the following in the debug file:

14 verbose stack TypeError: Cannot set properties of null (setting 'peer')
14 verbose stack     at visit (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:101:54)
14 verbose stack     at visitNode (/opt/homebrew/lib/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:58:25)
14 verbose stack     at next (/opt/homebrew/lib/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:44:19)
14 verbose stack     at depth (/opt/homebrew/lib/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:83:10)
14 verbose stack     at depth (/opt/homebrew/lib/node_modules/npm/node_modules/treeverse/lib/depth.js:27:12)
14 verbose stack     at unsetFlag (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:96:5)
14 verbose stack     at /opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:63:7
14 verbose stack     at CIMap.forEach (<anonymous>)
14 verbose stack     at calcDepFlagsStep (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:41:17)
14 verbose stack     at calcDepFlagsStep (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:38:12)
15 error Cannot set properties of null (setting 'peer')

I currently use pnpm attw $(pnpm pack) as workaround but it would be nice if the --pack option used the same package manager.
This could be detected automatically with a package like detect-package-manager or passed manually as an option.
Yarn seems to use this protocol too for workspaces.

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