I'm using MacOS monterey with M1 chip as my operating system. installed NestJS cli using this command: sudo npm install -g @nestjs/cli
when creating new nest project using nest new message
everything works fine, but when I try to create new module using this command nest generate module messages
I face error.
why does this happen? I tried installing schematics using npm i -g @nestjs/schematics
, I don't know if I should've installed it but this didn't help anyway.
The error I face is:
/Users/homayoun/training/messages/node_modules/@angular-devkit/schematics-cli/bin/schematics.js:338
throw new Error(`Unknown argument ${key}. Did you mean ${(0, yargs_parser_1.decamelize)(key)}?`);
^
Error: Unknown argument skipImport. Did you mean skip-import?
at parseArgs (/Users/homayoun/training/messages/node_modules/@angular-devkit/schematics-cli/bin/schematics.js:338:19)
at main (/Users/homayoun/training/messages/node_modules/@angular-devkit/schematics-cli/bin/schematics.js:122:49)
at Object.<anonymous> (/Users/homayoun/training/messages/node_modules/@angular-devkit/schematics-cli/bin/schematics.js:367:5)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Failed to execute command: node @nestjs/schematics:module --name=messages --no-dry-run --no-skipImport --language="ts" --sourceRoot="src" --spec.
worth noting that I don't face any issues when I do the same thing on ubuntu 20 or 22
"root": "src"
cd src
nest generate module messages
if the above does not work also try changing the version of packages in package.json to
"@nestjs/cli": "8.2.6",
"@nestjs/schematics": "8.0.11",
removing the node modules in the current project reinstalling the nest cli with
npm uninstall -g @nestjs/cli
npm i -g @nestjs/cli@8.2.6