nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
67.78k stars 7.64k forks source link

Cannot find module 'E:\Javascript\Projects\@nestjs\cli\bin\nest.js' #9490

Closed fahadali503 closed 2 years ago

fahadali503 commented 2 years ago

Is there an existing issue for this?

Current behavior

npm run start:dev

user-service@0.0.1 start:dev nest start --watch

'Meet\user-service\node_modules.bin\' is not recognized as an internal or external command, operable program or batch file. node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module 'E:\Javascript\Projects\@nestjs\cli\bin\nest.js' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Minimum reproduction code

https://github.com/fahadali503/invite-and-sale-user-service

Steps to reproduce

npm run start:dev

Expected behavior

After initializing new project and run npm run start:dev, I face this issue.


 npm run start:dev

> user-service@0.0.1 start:dev
> nest start --watch

'Meet\user-service\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'E:\Javascript\Projects\@nestjs\cli\bin\nest.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Package

Other package

No response

NestJS version

No response

Packages versions

{
  "name": "user-service",
  "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": "^8.0.0",
    "@nestjs/config": "^2.0.0",
    "@nestjs/core": "^8.0.0",
    "@nestjs/platform-express": "^8.0.0",
    "@typegoose/typegoose": "^9.8.1",
    "@types/bcryptjs": "^2.4.2",
    "bcryptjs": "^2.4.3",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.13.2",
    "mongoose": "^6.3.1",
    "nestjs-typegoose": "^7.1.38",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0"
  },
  "devDependencies": {
    "@nestjs/cli": "^8.0.0",
    "@nestjs/schematics": "^8.0.0",
    "@nestjs/testing": "^8.4.4",
    "@types/express": "^4.17.13",
    "@types/jest": "27.4.1",
    "@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": "^27.2.5",
    "prettier": "^2.3.2",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "^27.0.3",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "^3.10.1",
    "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

16.14.2

In which operating systems have you tested?

Other

npm run start:dev

user-service@0.0.1 start:dev nest start --watch

'Meet\user-service\node_modules.bin\' is not recognized as an internal or external command, operable program or batch file. node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module 'E:\Javascript\Projects\@nestjs\cli\bin\nest.js' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

micalevisk commented 2 years ago

I didn't have an Windows machine. The following went fine in my Linux (except from app issues):

git clone git@github.com:fahadali503/invite-and-sale-user-service.git
cd invite-and-sale-user-service
npm ci
npm run start:dev

can you try the above?

fahadali503 commented 2 years ago

I didn't have an Windows machine. The following went fine in my Linux (except from app issues):

git clone git@github.com:fahadali503/invite-and-sale-user-service.git
cd invite-and-sale-user-service
npm ci
npm run start:dev

can you try the above?

didn't work.

fahadali503 commented 2 years ago

I solved this by installing Yarn and then added nestjs/cli globally using yarn