Couple of weeks ago I installed NestJS globally on my computer. Now I'm coming back to that, to start learning.
So I created new project with comand:
nest new ./
It generated all the files, but when I try to run this application with command:
nest start
I expected this template project to start but there are errors with importing paths? Is this due to version of my installed Nest or something?
Version of my Nest:
7.5.6
Package.json:
"dependencies": {
"@nestjs/common": "^7.6.13",
"@nestjs/core": "^7.6.13",
"@nestjs/platform-express": "^7.6.13",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^6.6.6"
},
"devDependencies": {
"@nestjs/cli": "^7.5.6",
"@nestjs/schematics": "^7.2.7",
"@nestjs/testing": "^7.6.13",
"@types/express": "^4.17.11",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.31",
"@types/supertest": "^2.0.10",
"@typescript-eslint/eslint-plugin": "^4.15.2",
"@typescript-eslint/parser": "^4.15.2",
"eslint": "^7.20.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1",
"jest": "^26.6.3",
"prettier": "^2.2.1",
"supertest": "^6.1.3",
"ts-jest": "^26.5.2",
"ts-loader": "^8.0.17",
"ts-node": "^9.1.1",
"tsconfig-paths": "^3.9.0",
"typescript": "^4.1.5"
},
I had the same issue. The following two commands fixed it:
npm install @nestjs/common
npm install @nestjs/core
These commands make sure you are using the lastest versions of those packages.
Sometimes you may also get error: Cannot find module '@nestjs/mapped-types' or its corresponding type declarations.
In that case, do:
npm install @nestjs/mapped-types