I am working with a teammate whose environment is OSX while mine is Windows. and we all have same version of node, npm, nestJS:
- node version: 18.5.0
- npm version: 8.12.1
- nestjs version: 9.1.8.
and when I try to install the dependency it keeps getting an error. and the message is like this:
npm ERR! code ERESOLVE<br>
npm ERR! ERESOLVE unable to resolve dependency tree<br>
npm ERR!<br>
npm ERR! While resolving: projectname<br>
npm ERR! Found: [email protected]<br>
npm ERR! node_modules/typeorm<br>
npm ERR! typeorm@"^0.2.45" from the root project<br>
npm ERR!<br>
npm ERR! Could not resolve dependency:<br>
npm ERR! peer typeorm@"^0.3.0" from @nestjs/[email protected]<br>
npm ERR! node_modules/@nestjs/typeorm<br>
npm ERR! @nestjs/typeorm@"^9.0.1" from the root project<br>
npm ERR!<br>
npm ERR! Fix the upstream dependency conflict, or retry<br>
npm ERR! this command with --force, or --legacy-peer-deps<br>
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.<be>
when I tried to install typeorm 0.3.0
it also made another error:
npm ERR! code ERESOLVE<br>
npm ERR! ERESOLVE unable to resolve dependency tree<br>
npm ERR!<br>
npm ERR! While resolving: projectname<br>
npm ERR! Found: @nestjs/[email protected]<br>
npm ERR! node_modules/@nestjs/common<br>
npm ERR! @nestjs/common@"^9.2.1" from the root project<br>
npm ERR!<br>
npm ERR! Could not resolve dependency:<br>
<br>
npm ERR! peer @nestjs/common@"^8.0.0" from @nestjs/[email protected]<br>
npm ERR! node_modules/@nestjs/testing<br>
npm ERR! dev @nestjs/testing@"^8.0.0" from the root project<br>
npm ERR!<br>
npm ERR! Fix the upstream dependency conflict, or retry<br>
npm ERR! this command with --force, or --legacy-peer-deps<br>
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.<be>
and when I tried to install with npm install --legacy-peer-deps
I got a proxy error and I never use proxy. I don't know what is wrong.
and the dependencies I have:
"dependencies": {
"@nestjs/common": "^9.2.1",
"@nestjs/config": "^2.2.0",
"@nestjs/core": "^9.2.1",
"@nestjs/mapped-types": "^1.2.0",
"@nestjs/platform-express": "^9.2.1",
"@nestjs/schedule": "^2.1.0",
"@nestjs/swagger": "^6.1.4",
"@nestjs/typeorm": "^9.0.1",
"@pinata/sdk": "^1.1.26",
"@types/cron": "^2.0.0",
"aws-sdk": "^2.1167.0",
"axios": "^1.2.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.2",
"decimal.js": "^10.4.1",
"dotenv": "^16.0.1",
"get-audio-duration": "^3.1.0",
"ipfs-http-client": "^56.0.2",
"mysql2": "^2.3.3",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0",
"speakeasy": "^2.0.0",
"swagger-ui-express": "^4.4.0",
"typeorm": "^0.3.0"
},
"devDependencies": {
"@nestjs/cli": "^8.0.0",
"@nestjs/schematics": "^8.0.0",
"@nestjs/testing": "^8.0.0",
"@types/express": "^4.17.13",
"@types/jest": "27.5.0",
"@types/multer": "^1.4.7",
"@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.0.3",
"prettier": "^2.3.2",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "28.0.1",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "4.0.0",
"typescript": "^4.3.5"
},
CodePudding user response:
You have typeorm 0.2.45 installed when @nestjs/typeorm
requires that you use typeorm 0.3.0 or greater. Install the newer version of TypeORM and migrate as necessary as there are breaking changes
CodePudding user response:
Since you're working in dev
environment, devDependencies is also installed and makes the conflicts.
To fix this, you need to update @nestjs/cli
, @nestjs/schematics
and @nestjs/testing
to 9.x.x.