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

ENOTDIR: not a directory, stat 'workspace.json/node_modules' #1198

Closed
wSedlacek opened this issue Dec 16, 2021 · 8 comments · Fixed by #1200
Closed

ENOTDIR: not a directory, stat 'workspace.json/node_modules' #1198

wSedlacek opened this issue Dec 16, 2021 · 8 comments · Fixed by #1200
Assignees

Comments

@wSedlacek
Copy link

wSedlacek commented Dec 16, 2021

When attempting to run the nx.generate command from the command palette the following error message is thrown.

Command 'Nx: generate' resulted in an error (A system error occurred (ENOTDIR: not a directory, stat 'workspace.json/node_modules'))

macOS 12.0.1
vscode 1.63.1
nx-console 17.13.1

Error does not occur on 17.12.4

@wSedlacek
Copy link
Author

wSedlacek commented Dec 16, 2021

I believe the issue is at one of these locations it has the path to workspace.json rather than the root of the workspace.

const nodeModulesDir = join(workspacePath, 'node_modules');

const nodeModulesDir = join(workspacePath, 'node_modules');

path.join(basedir, 'node_modules')

if (!(await directoryExists(join(workspacePath, 'node_modules')))) {

@Cammisuli Cammisuli self-assigned this Dec 16, 2021
@Cammisuli
Copy link
Member

now this one is a thinker.. There's only two places that set the workspace path that's stored in the Workspace configuration:

WorkspaceConfigurationStore.instance.set('nxWorkspacePath', workspacePath);

and
WorkspaceConfigurationStore.instance.set('nxWorkspacePath', workspacePath);

The function that did call this was changed recently, but it still only sets the directory instead of the json file.

Do you have a repo that I can look at to reproduce this somehow?

@Cammisuli
Copy link
Member

potentially fixed with #1199 where it will release as 17.13.2

@wSedlacek
Copy link
Author

Do you have a repo that I can look at to reproduce this somehow?

This occurs on any Nx repo, including this one, at least for me.
Simply open the command palette (CMD + SHIFT + P) then type nx and select Nx: generate and the error occurs right away.

potentially fixed with #1199 where it will release as 17.13.2

I cloned the repo and built from master locally and the issue was still occurring.

@wSedlacek
Copy link
Author

I used git bisect and this is the commit it spit out

[630ac6e] feat: use nx utils to read all configuration files (#1184)

@Cammisuli
Copy link
Member

I suspected it was that commit. Thanks for your help!

@Cammisuli
Copy link
Member

Cammisuli commented Dec 16, 2021

Please check out 17.13.2 and let me know if that doesn't work. If I don't get a rely back, then I can sleep at night 😅

@wSedlacek
Copy link
Author

Ay, it's working again!

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants