Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some CLI commands do not work in project root directory #13599

Closed
3 of 15 tasks
Atif-Bashir-1998 opened this issue May 18, 2024 · 4 comments
Closed
3 of 15 tasks

Some CLI commands do not work in project root directory #13599

Atif-Bashir-1998 opened this issue May 18, 2024 · 4 comments
Labels
needs triage This issue has not been looked into

Comments

@Atif-Bashir-1998
Copy link

Atif-Bashir-1998 commented May 18, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Command outputs no message at all. It is also not generating a new module

Minimum reproduction code

None

Steps to reproduce

Followed the steps mentioned in official documentation(https://docs.nestjs.com/first-steps).

1, npm i -g @nestjs/cli
2. nest new project-name
3. nest g module cats

Expected behavior

A module should be generated

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

nestjs/cli

NestJS version

9.0.0

Packages versions

{
  "name": "todo-list",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "private": true,
  "license": "UNLICENSED",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json"
  },
  "dependencies": {
    "@nestjs/common": "^9.0.0",
    "@nestjs/core": "^9.0.0",
    "@nestjs/platform-express": "^9.0.0",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0"
  },
  "devDependencies": {
    "@nestjs/cli": "^9.0.0",
    "@nestjs/schematics": "^9.0.0",
    "@nestjs/testing": "^9.0.0",
    "@types/express": "^4.17.13",
    "@types/jest": "28.1.4",
    "@types/node": "^16.0.0",
    "@types/supertest": "^2.0.11",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "eslint": "^8.0.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "jest": "28.1.2",
    "prettier": "^2.3.2",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "28.0.5",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "4.0.0",
    "typescript": "^4.3.5"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}


Node.js version

20.10.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

Image of the console(https://ibb.co/dr0KK9B)

@Atif-Bashir-1998 Atif-Bashir-1998 added the needs triage This issue has not been looked into label May 18, 2024
@kamilmysliwiec
Copy link
Member

Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).

@micalevisk
Copy link
Member

try it out with npx nest ... after the nest new

@Atif-Bashir-1998
Copy link
Author

Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).

Just follow the steps mentioned in the official documentation and you will get the error. I have listed the steps to reproduce the issue. I believe it is in the nest-cli

@micalevisk
Copy link
Member

micalevisk commented May 25, 2024

@Atif-Bashir-1998 I just ran those steps on my Ubuntu with nodejs v22 and v20 and everything went fine here

image

btw you missed the cd project-name step in your steps to reproduce.

As I said before, try to use npx instead of the globally installed CLI. So npx nest g module cats


If you believe that you found issues with @nestjs/cli, please report it to the https://github.com/nestjs/nest-cli/ repo next time.

@kamilmysliwiec kamilmysliwiec reopened this Jun 2, 2024
@nestjs nestjs locked and limited conversation to collaborators Jun 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

3 participants