nestjs / nest-cli

CLI tool for Nest applications 🍹
https://nestjs.com
Other
1.95k stars 389 forks source link

Error. Schematic "1" not found in collection "@nestjs/schematics #80

Closed Yerkon closed 6 years ago

Yerkon commented 6 years ago

When running nest generate controller test. Error occurs:

Error: Schematic "1" not found in collection "@nestjs/schematics".
    at SchematicEngine.createSchematic (C:\Users\Erkebulan\AppData\Roaming\npm\node_modules\@nestjs\cli\node_modules\@angular-devkit\schematics\src\engine\engine.js:155:23)
    at CollectionImpl.createSchematic (C:\Users\Erkebulan\AppData\Roaming\npm\node_modules\@nestjs\cli\node_modules\@angular-devkit\schematics\src\engine\collection.js:12:29)
    at NodeWorkflow.execute (C:\Users\Erkebulan\AppData\Roaming\npm\node_modules\@nestjs\cli\node_modules\@angular-devkit\schematics\tools\workflow\node-workflow.js:54:38)
    at Object.<anonymous> (C:\Users\Erkebulan\AppData\Roaming\npm\node_modules\@nestjs\cli\node_modules\@angular-devkit\schematics-cli\bin\schematics.js:172:10)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
Failed to execute command : @nestjs/schematics:1 --name=test --dry-run=false, see above. 

nest.js 5.0.0 - Nest CLI

thomrick commented 6 years ago

fixed on version 4.0.1 and 5.0.1, please upgrade

Yerkon commented 6 years ago

new error:

Unexpected token } in JSON at position 79
Failed to execute command : @nestjs/schematics:controller --name=test --dry-run=false, see above.

package.json:

{
  "name": "nest-typescript-starter",
  "version": "1.0.0",
  "description": "Nest TypeScript starter repository",
  "license": "MIT",
  "scripts": {
    "format": "prettier --write \"**/*.ts\"",
    "start": "ts-node -r tsconfig-paths/register src/main.ts",
    "start:dev": "nodemon",
    "prestart:prod": "rm -rf dist && tsc",
    "start:prod": "node dist/main.js",
    "test": "jest",
    "test:cov": "jest --coverage",
    "test:e2e": "jest --config ./test/jest-e2e.json"
  },
  "dependencies": {
    "@nestjs/common": "^4.5.9",
    "@nestjs/core": "^4.5.10",
    "@nestjs/microservices": "^4.5.8",
    "@nestjs/testing": "^4.5.5",
    "@nestjs/websockets": "^4.5.8",
    "reflect-metadata": "^0.1.12",
    "rxjs": "^5.5.6",
    "typescript": "^2.6.2"
  },
  "devDependencies": {
    "@types/express": "^4.0.39",
    "@types/jest": "^21.1.8",
    "@types/node": "^9.3.0",
    "@types/supertest": "^2.0.4",
    "jest": "^21.2.1",
    "nodemon": "^1.14.1",
    "prettier": "^1.11.1",
    "supertest": "^3.0.0",
    "ts-jest": "^21.2.4",
    "ts-node": "^4.1.0",
    "tsconfig-paths": "^3.1.1",
    "tslint": "5.3.2"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".spec.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "coverageDirectory": "../coverage"
  }
}
leehoisleeho commented 2 months ago

why??? $ nest generate module music
Error: Path "/Users/leeHo/code/preject_nest/node_modules/@nestjs/schematics/dist/collection.json" does not exist.

Failed to execute command: node @nestjs/schematics:module --name=music --no-dry-run --no-skip-import --language="ts" --source-root="src" --spec --no-flat --spec-file-suffix="spec"