Skip to content

[@nx/js] nx sync on windows machine fails due to path mismatch #31232

@unknownbanana

Description

@unknownbanana

Current Behavior

When following the NX migration guide to PNPM workspace and TS project references and running nx sync to automatically update project references using the @nx/js:typescirpt syncGenerator we get a error message and sync fails to add project references.

Expected Behavior

We would expect there to be no path mismatch due to mixed useage of POSIX and Windows path seperators.

GitHub Repo

No response

Steps to Reproduce

  1. Follow the NX migration guide .
  2. Run nx sync on a windows machine.
  3. Observe the error message.

Nx Report

Node           : 20.14.0
OS             : win32-x64
Native Target  : x86_64-windows
pnpm           : 9.3.0

nx                     : 20.8.0
@nx/js                 : 20.8.0
@nx/jest               : 20.8.0
@nx/eslint             : 20.8.0
@nx/workspace          : 20.8.0
@nx/angular            : 20.8.0
@nx/devkit             : 20.8.0
@nx/esbuild            : 20.8.0
@nx/eslint-plugin      : 20.8.0
@nx/module-federation  : 20.8.0
@nx/rspack             : 20.8.0
@nx/web                : 20.8.0
@nx/webpack            : 20.8.0
typescript             : 5.7.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
---------------------------------------
Community plugins:
@testing-library/angular : 16.0.0
ng-mocks                 : 14.13.4
---------------------------------------
Cache Usage: 0.00 B / 47.49 GB

Failure Logs

Error: Debug Failure. Expected <redacted/path>/frontend/tsconfig.json === <redacted\path>\frontend\tsconfig.json.
          at attachFileToDiagnostic (<redacted\path>\frontend\node_modules\.pnpm\typescript@5.7.3\node_modules\typescript\lib\typescript.js:21494:9)
          at attachFileToDiagnostics (<redacted\path>\frontend\node_modules\.pnpm\typescript@5.7.3\node_modules\typescript\lib\typescript.js:21523:34)
          at Object.parseJsonText2 [as parseJsonText] (<redacted\path>\frontend\node_modules\.pnpm\typescript@5.7.3\node_modules\typescript\lib\typescript.js:33002:35)
          at parseJsonText (<redacted\path>\frontend\node_modules\.pnpm\typescript@5.7.3\node_modules\typescript\lib\typescript.js:32759:17)
          at parseConfigFileTextToJson (<redacted\path>\frontend\node_modules\.pnpm\typescript@5.7.3\node_modules\typescript\lib\typescript.js:42125:26)
          at Object.readConfigFile (<redacted\path>\frontend\node_modules\.pnpm\typescript@5.7.3\node_modules\typescript\lib\typescript.js:42122:39)
          at readTsConfig (<redacted\path>\frontend\node_modules\.pnpm\@nx+js@20.8.0_@babel+traverse@7.27.0_@swc-node+register@1.9.1_@swc+core@1.5.7_@swc+helpers@0._uccmrte2ihwosqmuoddff2knoy\node_modules\@nx\js\src\plugins\typescript\plugin.js:679:27)
          at readTsConfigAndCache (<redacted\path>\frontend\node_modules\.pnpm\@nx+js@20.8.0_@babel+traverse@7.27.0_@swc-node+register@1.9.1_@swc+core@1.5.7_@swc+helpers@0._uccmrte2ihwosqmuoddff2knoy\node_modules\@nx\js\src\plugins\typescript\plugin.js:627:22)
          at initializeTsConfigCache (<redacted\path>\frontend\node_modules\.pnpm\@nx+js@20.8.0_@babel+traverse@7.27.0_@swc-node+register@1.9.1_@swc+core@1.5.7_@swc+helpers@0._uccmrte2ihwosqmuoddff2knoy\node_modules\@nx\js\src\plugins\typescript\plugin.js:613:9)
          at exports.createNodesV2 (<redacted\path>\frontend\node_modules\.pnpm\@nx+js@20.8.0_@babel+traverse@7.27.0_@swc-node+register@1.9.1_@swc+core@1.5.7_@swc+helpers@0._uccmrte2ihwosqmuoddff2knoy\node_modules\@nx\js\src\plugins\typescript\plugin.js:63:9)

Package Manager Version

No response

Operating System

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

Additional Information

Seems to be caused by the use of a NodeJS join() when intializing the cache for tsconfig files when creating the project graph. [ https://github.com/nrwl/nx/blob/master/packages/js/src/plugins/typescript/plugin.ts#L1144 ]

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions