nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.52k stars 2.34k forks source link

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

Closed PanosR closed 8 months ago

PanosR commented 8 months ago

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

Additional Information

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

Tested in more than one product workspaces with same results.

github-actions[bot] commented 7 months ago

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.