nx icon indicating copy to clipboard operation
nx copied to clipboard

create-nx-workspace fails on standalone nestjs application scaffolding

Open binaryartifex opened this issue 4 months ago • 1 comments

Current Behavior

create-nx-workspace consistently crashes when attempting to scaffold a new standalone nestjs application

Expected Behavior

Successfully scaffold out a new standalone nestjs application

GitHub Repo

No response

Steps to Reproduce

  1. run pnpm dlx create-nx-workspace
  2. Fill in the following when presented with each prompt... 2a. Where would you like to create your workspace? · web-server 2b. Which stack do you want to use? · node 2c. What framework should be used? · nest 2d. Integrated monorepo, or standalone project? · standalone 2e. Would you like to generate a Dockerfile? [https://docs.docker.com/] · Yes 2f. Do you want Nx Cloud to make your CI fast? · skip

Nx Report

Node   : 20.11.0
   OS     : win32-x64
   pnpm   : 8.15.1

   nx             : 18.0.4
   @nx/js         : 18.0.4
   @nx/jest       : 18.0.4
   @nx/linter     : 18.0.4
   @nx/eslint     : 18.0.4
   @nx/workspace  : 18.0.4
   @nx/devkit     : 18.0.4
   @nx/node       : 18.0.4
   @nrwl/tao      : 18.0.4
   typescript     : 5.3.3

Failure Logs

Progress: resolved 1, reused 0, downloaded 0, added 0
Progress: resolved 68, reused 59, downloaded 0, added 0
Progress: resolved 152, reused 142, downloaded 0, added 0
Progress: resolved 206, reused 197, downloaded 0, added 0
Progress: resolved 281, reused 272, downloaded 0, added 0
Progress: resolved 357, reused 348, downloaded 0, added 0
Progress: resolved 448, reused 438, downloaded 0, added 0
Progress: resolved 500, reused 490, downloaded 0, added 0
Progress: resolved 535, reused 525, downloaded 0, added 0
Progress: resolved 545, reused 535, downloaded 0, added 0
Packages: +537
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 547, reused 537, downloaded 0, added 194
Progress: resolved 547, reused 537, downloaded 0, added 534
Progress: resolved 547, reused 537, downloaded 0, added 537, done
.../.pnpm/[email protected]/node_modules/nx postinstall$ node ./bin/post-install
.../.pnpm/[email protected]/node_modules/nx postinstall: Done

devDependencies:
+ @nx/node 18.0.4
+ @nx/workspace 18.0.4
+ nx 18.0.4

Done in 17.3s

>  NX  Generating @nx/workspace:preset

Fetching @nx/nest...
Fetching prettier...
Fetching @nx/webpack...

 >  NX   generateFiles: No files found in "/Users/[me]/AppData/Local/Temp/tmp-5760-jVCL0UxX92pd/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]/node_modules/@nx/nest/src/generators/application/files". Are you sure you specified the correct path?

   Pass --verbose to see the stacktrace.


 >  NX   Workspace creation failed, see above.

   Pass --verbose to see the stacktrace.

Package Manager Version

pnpm - 8.15.1

Operating System

  • [ ] macOS
  • [ ] Linux
  • [X] Windows
  • [ ] Other (Please specify)

Additional Information

Attempting nx project scaffolding on a hard drive separate to the OS hosted hard drive.

binaryartifex avatar Feb 10 '24 23:02 binaryartifex

I had the same problem while also using windows. I was trying to create a NestJS integrated project using nx, but the same error happened at Fetching @nx/webpack.... Taking a look at other github issue

create-nx-workspace does not generate a project if you use vite, not webpack

There was this comment, which solves the problem for me.

I tried to launch the same command in different contexts : from my C: hdd drive , in the temp folder => it works from my E: ssd drive => it failed

I was also trying to setup a new project in my E:/ SSD Drive and when I tried on my main drive C:/ everything worked fine.

Dhalias avatar Feb 17 '24 13:02 Dhalias

this is STILL an issue. On account of NX being categorically unable to scaffold anything on a separate hdd to the windows OS i usually scaffold my projects on my OS hdd and just move them across. however i can't even do that atm. When trying to scaffold a standard, standalone nestjs application, i get the following error

$ pnpm dlx create-nx-workspace
Packages: +56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 56, reused 56, downloaded 0, added 56, done

 NX   Let's create a new workspace [https://nx.dev/getting-started/intro]

√ Where would you like to create your workspace? · web-server
√ Which stack do you want to use? · node
√ What framework should be used? · nest
√ Integrated monorepo, or standalone project? · standalone
√ Would you like to generate a Dockerfile? [https://docs.docker.com/] · Yes
√ Do you want Nx Cloud to make your CI fast? · skip

 NX   Creating your v18.2.3 workspace.

✔ Installing dependencies with pnpm
✖ Creating your workspace in web-server

 NX   Failed to create a workspace.

Error: 'ode_modules' is not recognized as an internal or external command,
operable program or batch file.

just about ready to give up on this whole monorepo idea...which is awkward cause i pushed for nx in our workplace and now im left having to explain away sh*t like this every other nx release...

binaryartifex avatar Apr 07 '24 20:04 binaryartifex

Hey @binaryartifex! I’m sorry that I haven’t been able to fix this in a fashion that would be timely for you.

It is on my list, and it will be addressed.

As a potential workaround for now, have you tried using WSL when working with Nx and other dev tools in general?

https://learn.microsoft.com/en-us/windows/wsl/install

This is not an excuse, however, windows tends to present more challenges due to how it handles file handles, permissions and its file system in general. Running on Unix-based system presents the most compatibility.

As I said, it’s not an excuse, we should support Windows in the same manner, and I will address this.

Coly010 avatar Apr 08 '24 08:04 Coly010

@Coly010 cheers for the reply mate i shouldn't of aired my frustrations like that i apologise it wasn't directed to anyone in particular. ultimately i blame the windows OS purely on principal/spite ;) i understand you guys are under the pump with endless issues that need addressing. in your own time mate, ill give that workaround a crack

binaryartifex avatar Apr 08 '24 09:04 binaryartifex