Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

project-graph cannot be generated in workspaces running on Windows and without git #9584

Closed
strobocopter opened this issue Mar 29, 2022 · 1 comment · Fixed by #9585
Closed
Labels

Comments

@strobocopter
Copy link

strobocopter commented Mar 29, 2022

Current Behavior

When running any operation that depends on a project-graph being build (e.g. running dep-graph for visualisation in the browser or trying to build libraries with dependencies), it will fail if the nx-workspace runs on a Windows operating system and is not using git.

Expected Behavior

Generation of the project-graph should work on windows without using a git-repo tool

Steps to Reproduce

1.) Create a new nx-workspace on windows machine
2.) Make sure the workspace does not contain .git-Folder or .gitignore files
3.) Have a least two libraries in the workspace, with one having a typescript import for the other
4.) run "nx graph"
-> Dependency is not shown

Failure Logs

Instead of posting failure logs I will just detail on my findings (actually I was able to fix the problem by patching the "file-map-utils.js" in the @nrwl/workspace package).

What I reverse-engineered:

  • When building a project-graph nx will first build up hashes for all files in the workspace
  • By default it tries to use a git-hasher, but if this fails it falls back to a node-based-file-hasher
  • The file-hasher creates file-description objects that contain the path of the file as well as it's current hash
  • The git-hasher creates file-paths that look like "hello/world/file"
  • On windows systems the node-based-file-hasher creates file-paths that look like "hello\\world\\file"
  • For generating the project-graph the "file-map-utils" are used to create a map that carries all file-descriptions for a given project
  • The keys in this map are taken from the "root"-property of the project.json files and usually look like "hello/world/file"
    --> Filling up this map does not work on windows systems since the keys will never match the paths from the file-descriptions

Environment

Node : 14.18.3
OS : win32 x64
npm : 6.14.15

nx : 13.9.4
@nrwl/angular : 13.9.4
@nrwl/cypress : 13.9.4
@nrwl/workspace : 13.9.4
typescript : 4.5.5
rxjs : 6.6.7

Community plugins:
@dcs/builders: 2.0.1 (you won't find this on a public repo)
@dcs/schematics: 2.0.2 (you won't find this on a public repo)

AgentEnder added a commit to AgentEnder/nx that referenced this issue Mar 29, 2022
Node hasher paths need to be normalized, since on windows they return with '\' instead of '/' and don't match keys in workspace configuration.

Fixes nrwl#9584
Fixes nrwl#9581
AgentEnder added a commit to AgentEnder/nx that referenced this issue Mar 29, 2022
Node hasher paths need to be normalized, since on windows they return with '\' instead of '/' and don't match keys in workspace configuration.

Fixes nrwl#9584
Fixes nrwl#9581
@AgentEnder AgentEnder added the scope: core core nx functionality label Mar 29, 2022
AgentEnder added a commit to AgentEnder/nx that referenced this issue Mar 29, 2022
Node hasher paths need to be normalized, since on windows they return with '\' instead of '/' and don't match keys in workspace configuration.

Fixes nrwl#9584
Fixes nrwl#9581
AgentEnder added a commit to AgentEnder/nx that referenced this issue Mar 29, 2022
Node hasher paths need to be normalized, since on windows they return with '\' instead of '/' and don't match keys in workspace configuration.

Fixes nrwl#9584
Fixes nrwl#9581
FrozenPandaz pushed a commit that referenced this issue Mar 29, 2022
Node hasher paths need to be normalized, since on windows they return with '\' instead of '/' and don't match keys in workspace configuration.

Fixes #9584
Fixes #9581
sidmonta pushed a commit to sidmonta/nx that referenced this issue Apr 2, 2022
Node hasher paths need to be normalized, since on windows they return with '\' instead of '/' and don't match keys in workspace configuration.

Fixes nrwl#9584
Fixes nrwl#9581
@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants