Skip to content

feat(config): normalise windows workspace paths #126

Closed

Description

@boeckMt

Description

Get package json files patterns - paths not normalized with older npm version

Version of syncpack: 9.8.4
OS: Windows
Package Manager: NPM


I have the following root package.json in a monorepo

{
  "name": "ng-workspace-test",
  "workspaces": [
    "projects\\apps\\test-app1",
    "projects\\apps\\test-app2",
    "projects\\libs\\lib1",
    "projects\\libs\\lib2",
    "projects\\libs\\lib3"
  ],
  ...
  "syncpack": {
    "source": [
      "projects/*/package.json"
    ]
  }
}

workspaces are added through the commands (It was with an older npm version 7.24.2)

  • npm init -w ./projects/app/<name> or
  • npm init -w ./projects/libs/<name>

this added the \\ slashes somehow, this is reproducible with npm i npm@7.24.2 -g

With a more current npm version 9.5.1 this is not happening anymore, than its like

...
 "workspaces": [
    "projects/apps/test-app1",
    ...
  ],
---

With the old workspaces config patterns are not matched and therefore no package.json files are found.

E.g. in get-file-paths.ts, then the pattern looks something like projects\libs\lib1/package.json

const ERR_GLOB_MISS = `No package.json files match pattern "${pattern}"`;

Suggested Solution

replace slashes in patterns pattern = pattern.replace(/\\/g, '/');

Note Glob patterns should always use / as a path separator, even on Windows systems...
https://github.com/isaacs/node-glob

syncpack/src/lib/disk.ts

Lines 39 to 41 in 2f1ffba

globSync(pattern: string): string[] {
verbose('globSync(', pattern, ')');
return globSync(pattern, {

Workaround

For anyone using an older npm workspace configuration (maybe only on windows), replace the \\ slashes with / fixes the Issue.

Activity

  1. changed the title [-]Get package json files patterns - paths not normalized with older npm version[/-] [+]syncpack list-mismatches not finding package json files[/+] on Apr 7, 2023
  2. JamieMason commented on May 10, 2023

    @JamieMason
    Owner

    Thanks Mathias

  3. changed the title [-]syncpack list-mismatches not finding package json files[/-] [+]handling windows paths found in package manager configuration[/+] on May 11, 2023
  4. changed the title [-]handling windows paths found in package manager configuration[/-] [+]feat(config): normalise windows workspace paths[/+] on May 28, 2023
  5. added a commit that references this issue on Nov 5, 2025
    863f82a
  6. JamieMason commented on Nov 5, 2025

    @JamieMason
    Owner

    Released in 14.0.0-alpha.25

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions