node.jswindowsnpmnestjs

Nest CLI throws Cannot find module schematics.js when creating a new Project (Windows)


I'm trying to create a new project with NestJS on Windows, but the CLI fails with the following error: PS C:> nest new payments-ms ✨ We will scaffold your app in a few seconds..

✔ Which package manager would you ❤️ to use? npm node:internal/modules/cjs/loader:1215 throw err; ^

Error: Cannot find module 'C:\Users\david\Escritorio\Apps\NestJS\microservicios"C:\Users\david\AppData\Roaming\npm\node_modules@nestjs\cli\node_modules@angular-devkit\schematics-cli\bin\schematics.js"' at Module._resolveFilename (node:internal/modules/cjs/loader:1212:15) at Module._load (node:internal/modules/cjs/loader:1043:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:164:12) at node:internal/main/run_main_module:28:49 { code: 'MODULE_NOT_FOUND' }

Node.js v20.19.4

enter image description here

Environment:

Windows 11

Node: 20.19.4 (also tried with 22.17.1)

npm: 10.8.2

Nest CLI (global): 11.0.9 (although the NestJS GitHub releases only show 11.0.0 as the latest stable version)

What I tried:

It seems like the CLI is trying to run schematics.js from a path with double quotes inside, which breaks on Windows. In addition, in the morning I was working without any problems and I didn't move anything.


Solution

  • Same in MacOs

    System Information]
    OS Version     : macOS24.5.0
    NodeJS Version : v22.17.1
    NPM Version    : 10.9.2 
    
    [Nest CLI]
    Nest CLI Version : 11.0.9 
    

    I uninstall nest and I installed the 10.4.9 version, and now everything works

    npm i -g @nestjs/cli@10.4.9
    

    because these release history

      1. 11.0.9: Published 2 hours ago (as of July 30, 2025, 11:02 PM CST) - This is the latest version.

      2. 11.0.8: Published 3 hours ago

      3. 11.0.7: Published 3 months ago (around late April 2025)

      4. 11.0.6: Published 4 months ago (around late March 2025)

      5. 11.0.5: Published 5 months ago (around late February 2025)

      6. 11.0.0: Published 6 months ago (around late January 2025) - Major release for NestJS v11.

      7. 10.4.9: Published 8 months ago (around early December 2024)

      8. 10.4.0: Published a year ago (around late July 2024) - Major release for NestJS v10.