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

Nx run fails with Error: [Cannot find module] when workspaceRoot folder contains space #21462

Closed
1 of 4 tasks
PanosR opened this issue Jan 31, 2024 · 1 comment · Fixed by #21571
Closed
1 of 4 tasks
Labels

Comments

@PanosR
Copy link

PanosR commented Jan 31, 2024

Current Behavior

After migrating from NX 17.2.8 to 17.3.0, executing nx run project:target:configuration in any project inside the workspace raises the following error:

Error: Cannot find module 'C:\nx' at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15) at Module._load (node:internal/modules/cjs/loader:920:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Expected Behavior

Running nx run project:target:configuration should complete without errors.

GitHub Repo

No response

Steps to Reproduce

Same error occurs with workspace init too:

1.In windows, create folder C:\nx temp and initialize a new workspace with nx run project:target:configuration
2.Select option: [In this directory]

Some files are created but the command returns with error:

Error: Cannot find module 'C:\nx' at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15) at Module._load (node:internal/modules/cjs/loader:920:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: []

Nx Report

Node   : 18.16.0
OS     : win32-x64
yarn   : 1.22.21

nx                 : 17.3.0
@nx/js             : 17.3.0
@nx/jest           : 17.3.0
@nx/linter         : 17.3.0
@nx/eslint         : 17.3.0
@nx/workspace      : 17.3.0
@nx/angular        : 17.3.0
@nx/cypress        : 17.3.0
@nx/devkit         : 17.3.0
@nx/eslint-plugin  : 17.3.0
@nrwl/tao          : 17.3.0
@nx/web            : 17.3.0
@nx/webpack        : 17.3.0
typescript         : 5.3.3
---------------------------------------
Community plugins:
@cypress/schematic                        : 2.5.0
@ngneat/spectator                         : 15.0.1
@ngrx/component-store                     : 17.0.1
@ngrx/effects                             : 17.0.1
@ngrx/router-store                        : 17.0.1
@ngrx/store                               : 17.0.1
@ngrx/store-devtools                      : 17.0.1
@progress/kendo-angular-buttons           : 14.3.0
@progress/kendo-angular-charts            : 14.3.0
@progress/kendo-angular-conversational-ui : 14.3.0
@progress/kendo-angular-dateinputs        : 14.3.0
@progress/kendo-angular-dialog            : 14.3.0
@progress/kendo-angular-dropdowns         : 14.3.0
@progress/kendo-angular-editor            : 14.3.0
@progress/kendo-angular-excel-export      : 14.3.0
@progress/kendo-angular-grid              : 14.3.0
@progress/kendo-angular-icons             : 14.3.0
@progress/kendo-angular-inputs            : 14.3.0
@progress/kendo-angular-intl              : 14.3.0
@progress/kendo-angular-l10n              : 14.3.0
@progress/kendo-angular-label             : 14.3.0
@progress/kendo-angular-layout            : 14.3.0
@progress/kendo-angular-navigation        : 14.3.0
@progress/kendo-angular-notification      : 14.3.0
@progress/kendo-angular-pdf-export        : 14.3.0
@progress/kendo-angular-popup             : 14.3.0
@progress/kendo-angular-progressbar       : 14.3.0
@progress/kendo-angular-scheduler         : 14.3.0
@progress/kendo-angular-toolbar           : 14.3.0
@progress/kendo-angular-tooltip           : 14.3.0
@progress/kendo-angular-treelist          : 14.3.0
@progress/kendo-angular-treeview          : 14.3.0
@progress/kendo-angular-utils             : 14.3.0
ng-mocks                                  : 14.11.0
ngx-deploy-npm                            : 7.0.1

Failure Logs

yarn nx run core:build:development --verbose
yarn run v1.22.21
$ nx run core:build:development --verbose

> nx run core:build:development

node:internal/modules/cjs/loader:1078
  throw err;
  ^

Error: Cannot find module 'C:\QCS'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.16.0

Package Manager Version

No response

Operating System

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

Additional Information

Tested with latest supported node versions, but with same error.

Tested in more than one product workspaces with same results.

Copy link

github-actions bot commented Mar 5, 2024

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 5, 2024
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