-2

I'm trying to set up project from my working computer on my home one. But due to fixed dependency versions something going wrong.

Here is my dependencies:

  "dependencies": {
    "@nestjs-modules/mailer": "2.0.2",
    "@nestjs/common": "10.0.0",
    "@nestjs/config": "3.2.3",
    "@nestjs/core": "10.0.0",
    "@nestjs/jwt": "10.2.0",
    "@nestjs/platform-express": "10.0.0",
    "@nestjs/swagger": "7.3.1",
    "@nestjs/typeorm": "10.0.2",
    "bcrypt": "5.1.1",
    "bcryptjs": "2.4.3",
    "class-transformer": "0.5.1",
    "class-validator": "0.14.1",
    "dotenv": "16.4.5",
    "mysql2": "3.10.2",
    "nodemailer": "6.9.14",
    "pg": "8.4.0",
    "reflect-metadata": "0.1.13",
    "rxjs": "7.8.1",
    "typeorm": "0.3.20"
  },
  "devDependencies": {
    "@nestjs/cli": "10.0.0",
    "@nestjs/schematics": "10.0.0",
    "@nestjs/testing": "10.0.0",
    "@types/express": "4.17.17",
    "@types/jest": "29.5.2",
    "@types/node": "16.11.10",
    "@types/supertest": "6.0.0",
    "@typescript-eslint/eslint-plugin": "6.0.0",
    "@typescript-eslint/parser": "6.0.0",
    "eslint": "8.42.0",
    "eslint-config-prettier": "9.0.0",
    "eslint-plugin-prettier": "5.0.0",
    "jest": "29.5.0",
    "prettier": "3.0.0",
    "source-map-support": "0.5.21",
    "supertest": "6.3.3",
    "ts-jest": "29.1.0",
    "ts-loader": "9.4.3",
    "ts-node": "10.9.1",
    "tsconfig-paths": "4.2.0",
    "typescript": "4.5.2"
  },

and error is:

$ npm install
npm warn ERESOLVE overriding peer dependency
npm warn While resolving: [email protected]
npm warn Found: [email protected]
npm warn node_modules/typescript
npm warn   dev typescript@"4.5.2" from the root project
npm warn   6 more (@nestjs/schematics, fork-ts-checker-webpack-plugin, ...)
npm warn
npm warn Could not resolve dependency:
npm warn peer typescript@">=4.8.2" from @nestjs/[email protected]
npm warn node_modules/@nestjs/schematics
npm warn   dev @nestjs/schematics@"10.0.0" from the root project
npm warn   1 more (@nestjs/cli)
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/typescript
npm error   dev typescript@"4.5.2" from the root project
npm error
npm error Could not resolve dependency:
npm error peer typescript@">=4.8.2" from @nestjs/[email protected]
npm error node_modules/@nestjs/schematics
npm error   dev @nestjs/schematics@"10.0.0" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error C:\Users\sydun\AppData\Local\npm-cache\_logs\2024-07-07T13_55_04_863Z-eresolve-report.txt

When I'm updating TypeScript version there are new errors:

node_modules/@types/superagent/types.d.ts:14:32 - error TS2304: Cannot find name 'URL'.

14 export type URLType = string | URL | UrlObject;
                                  ~~~

node_modules/@types/supertest/types.d.ts:9:7 - error TS2315: Type 'RequestListener' is not generic.

9     | RequestListener<typeof IncomingMessage, typeof ServerResponse>
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

What should I do?

1 Answer 1

0

update your typeescript and types/node to latest. if it still doesn't work then run below

npm install --legacy-peer-deps

if this also doesn't work then undo all the changes, and forcefully install each dependency using --force flag. it would work perfectly

Not the answer you're looking for? Browse other questions tagged or ask your own question.