nx: "contains invalid WIN32 path characters" when execute the command npx create-nx-workspace
Current Behavior
When try create a new project with Angular + SASS + ESLint + NxCloud/Not NxCloud with npx create-nx-workspace
Expected Behavior
Create a new project sucessfully
Steps to Reproduce
npm install -g @nrwl/cli@latest npm i -g @nrwl/workspace@latest npm install -g @nrwl/angular@latest npm install -g @angular/cli@latest npm install -g nx@latest npx create-nx-workspace@latest E:>npx create-nx-workspace@latest ? Workspace name (e.g., org name) empresa ? What to create in the new workspace angular [a workspace with a single Angular application] ? Application name tienda ? Default stylesheet format SASS(.scss) [ http://sass-lang.com ] ? Default linter ESLint [ Modern linting tool ] ? Use Nx Cloud? (It’s free and doesn’t require registration.) No
Failure Logs
E:>npx create-nx-workspace@latest ? Workspace name (e.g., org name) empresa ? What to create in the new workspace angular [a workspace with a single Angular application] ? Application name tienda ? Default stylesheet format SASS(.scss) [ http://sass-lang.com ] ? Default linter ESLint [ Modern linting tool ] ? Use Nx Cloud? (It’s free and doesn’t require registration.) No Creating a sandbox with Nx… new empresa --no-interactive --preset=angular --appName=tienda --style=scss --linter=eslint --no-nxCloud --collection=@nrwl/workspace CREATE empresa/nx.json CREATE empresa/package.json CREATE empresa/README.md CREATE empresa/tools/generators/.gitkeep CREATE empresa/tools/tsconfig.tools.json CREATE empresa/tsconfig.base.json CREATE empresa/.editorconfig CREATE empresa/.gitignore CREATE empresa/.prettierignore CREATE empresa/.vscode/extensions.json CREATE empresa/angular.json CREATE empresa/.prettierrc CREATE empresa/decorate-angular-cli.js CREATE empresa/apps/.gitkeep CREATE empresa/libs/.gitkeep \E:\empresa contains invalid WIN32 path characters. npm ERR! code 1 npm ERR! path C:\Users\ALVARO~1\AppData\Local\Temp\tmp-123440MhKDe8Wa3am npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c tao new empresa --no-interactive --preset=angular --appName=tienda --style=scss --linter=eslint --no-nxCloud --collection=@nrwl/workspace/collection.json --cli=angular --nxWorkspaceRoot=\E😕\
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\alvaroheavy\AppData\Local\npm-cache_logs\2021-02-03T13_01_18_000Z-debug.log
(node:12344) UnhandledPromiseRejectionWarning: Error: Command failed: npx tao new empresa --no-interactive --preset=angular --appName=tienda --style=scss --linter=eslint --no-nxCloud --collection=@nrwl/workspace/collection.json --cli=angular --nxWorkspaceRoot="E:/"
at checkExecSyncError (child_process.js:630:11)
at Object.execSync (child_process.js:666:15)
at createApp (C:\Users\alvaroheavy\AppData\Local\npm-cache_npx\505743838affa773\node_modules\create-nx-workspace\bin\create-nx-workspace.js:380:21)
at C:\Users\alvaroheavy\AppData\Local\npm-cache_npx\505743838affa773\node_modules\create-nx-workspace\bin\create-nx-workspace.js:97:29
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:12344) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12344) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Environment
Global packages npm: @angular-devkit/core 11.1.2 @angular/cli 11.1.2 @ionic/cli 6.12.4 @nrwl/angular 11.2.9 @nrwl/cli 11.2.9 @nrwl/workspace 11.2.9 capacitor-resources 2.0.5 cordova-res 0.15.3 cordova 9.0.0 native-run 1.3.0 node-dev 6.2.0 npm-gui 2.1.0 npm-server 0.0.1 npm 7.5.2 nx 11.2.9
Operating System: Windows Enterprise 10 x64 Processors: Intel i7 4770k Memory: 16 GiB of RAM
Notes
I tried different drives and different routes.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 7
- Comments: 22 (1 by maintainers)
Commits related to this issue
- fix #4690 — committed to AmineMx/nx by AmineMx 3 years ago
- feat(repo): run E2E tests on Windows (cmd) — committed to nrwl/nx by bekos 3 years ago
With v11.2.12 yes, this works in any path.
Thank you very much to all.
got a new error when i move project folder to
C:use #4734
everything is ok…
thx, bro. @ruekart
I’m sorry, but this doesn’t work …
\D:\prog\maxl contains invalid WIN32 path characters.EDIT : Even on
C:it won’t work …I think I’m gonna have to check for something else to build my project for now, because I kept pushing it back.
Here’s the log on
C::Here’s the complete log on
D::we just released v11.2.12 which should contain the fix for this: 57c6bacfb4c33aba5abe13a742791b5b315da528. Can you please try again and let us know if this works now as expected?
Another option is to use e.g. Ubuntu with the Windows Subsystem for Linux:
user.emailanduser.name(just avoids a later git error during setup of nx workspace)npm i -g create-nx-workspace@11.4.0cd /mnt/c/where/ever/your/workspace/iscreate-nx-workspace foobarThe created nx workspace can now be found in
C:\where\ever\your\workspace\is\foobarHow is this bug not a Critical? Can’t create workspace in
G:/PROJECTS/name/orG:/C:/or wherever. Windows it is.EDIT: Can I just copy rendered empty template from somewhere?
Seems like the issue was introduced by the change 9abdb78a4ab44c8bee1ca8fb09c763c011dc1db3 packages/create-nx-workspace/bin/create-nx-workspace.ts at line 422. I removed the ‘win32’ condition locally and successfully bypass the issue.
node v14.15.4 npm 6.14.9
I don’t know if is all npm 7 related. When I tried to create a workspace in my D unit in D:/project I’ve got this error:
But when I tried in my C unit in C:\project the workspace is created correctly with this output:
Then I moved my workspace manually to my D unit and the nx cli also worked perfectly.
Very good call @vltansky , that was indeed the issue! I downgraded node to v10.16.3 and npm to 6.14.11 then it worked as usual.
While using node v10.16.3 with npm@7, the issue was still present. It’s only when I went back to npm@6 that it worked.
Probably npm 7 is related. This error didn’t happen to me on another pc with npm 6 and everybody who wrote here has npm 7