Skip to content

npm v7 执行 install 时会出现依赖报错 #96

@tree-lock

Description

@tree-lock

npm v6 执行安装(本来用v7然后版本回退改用v6)

➜  service-mw2 git:(master) ✗ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: service-mw2@1.2.0
npm ERR! Found: @types/jest@26.0.24
npm ERR! node_modules/@types/jest
npm ERR!   dev @types/jest@"^26.0.24" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @types/jest@"^27.0.0" from ts-jest@27.0.5
npm ERR! node_modules/ts-jest
npm ERR!   dev ts-jest@"^27.0.4" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/xmo/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/xmo/.npm/_logs/2021-09-06T10_18_18_436Z-debug.log
➜  service-mw2 git:(master) ✗ npm install npm@6 -g

removed 70 packages, changed 98 packages, and audited 438 packages in 6s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
➜  service-mw2 git:(master) ✗ npm install
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated

> core-js@2.6.12 postinstall /home/xmo/code/demo/service-mw2/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> @midwayjs/cli@1.2.82 postinstall /home/xmo/code/demo/service-mw2/node_modules/@midwayjs/cli
> node ./postinstall

[midway] auto install complete
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN typeorm@0.2.37 requires a peer of @sap/hana-client@* but none is installed. You must install peer dependencies yourself.
npm WARN typeorm@0.2.37 requires a peer of better-sqlite3@* but none is installed. You must install peer dependencies yourself.
npm WARN typeorm@0.2.37 requires a peer of hdb-pool@* but none is installed. You must install peer dependencies yourself.
npm WARN typeorm@0.2.37 requires a peer of mongodb@^3.6.0 but none is installed. You must install peer dependencies yourself.
npm WARN typeorm@0.2.37 requires a peer of mssql@* but none is installed. You must install peer dependencies yourself.
npm WARN typeorm@0.2.37 requires a peer of oracledb@* but none is installed. You must install peer dependencies yourself.
npm WARN typeorm@0.2.37 requires a peer of pg@* but none is installed. You must install peer dependencies yourself.
npm WARN typeorm@0.2.37 requires a peer of pg-native@* but none is installed. You must install peer dependencies yourself.
npm WARN typeorm@0.2.37 requires a peer of pg-query-stream@* but none is installed. You must install peer dependencies yourself.
npm WARN typeorm@0.2.37 requires a peer of redis@* but none is installed. You must install peer dependencies yourself.
npm WARN typeorm@0.2.37 requires a peer of sql.js@* but none is installed. You must install peer dependencies yourself.
npm WARN typeorm@0.2.37 requires a peer of sqlite3@* but none is installed. You must install peer dependencies yourself.
npm WARN typeorm@0.2.37 requires a peer of typeorm-aurora-data-api-driver@* but none is installed. You must install peer dependencies yourself.
npm WARN ts-node@10.2.1 requires a peer of @swc/core@>=1.2.50 but none is installed. You must install peer dependencies yourself.
npm WARN ts-node@10.2.1 requires a peer of @swc/wasm@>=1.2.50 but none is installed. You must install peer dependencies yourself.
npm WARN ts-jest@27.0.5 requires a peer of @types/jest@^27.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ts-jest@27.0.5 requires a peer of babel-jest@>=27.0.0 <28 but none is installed. You must install peer dependencies yourself.
npm WARN ws@7.5.4 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws@7.5.4 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN jsdom@16.7.0 requires a peer of canvas@^2.5.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 2263 packages from 996 contributors in 253.695s

114 packages are looking for funding
  run `npm fund` for details

此处是 npm@7 错误重现。

➜  service-mw2 git:(master) ✗ npm -v
7.22.0
➜  service-mw2 git:(master) ✗ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: service-mw2@1.2.0
npm ERR! Found: @types/jest@26.0.24
npm ERR! node_modules/@types/jest
npm ERR!   dev @types/jest@"^26.0.24" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @types/jest@"^27.0.0" from ts-jest@27.0.5
npm ERR! node_modules/ts-jest
npm ERR!   dev ts-jest@"^27.0.4" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/xmo/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/xmo/.npm/_logs/2021-09-06T10_25_46_161Z-debug.log

虽然应该是 npm 的问题,但还是给遇到相似问题的人一些提示。如果遇到类似问题,npm install -g npm@6 版本回退即可;
另外,用yarn安装是不会产生问题的。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions