surmon-china / videojs-player

@videojs player component for @vuejs(3) and React.
https://github.surmon.me/videojs-player
MIT License
5.24k stars 1.13k forks source link

npm install twice error #463

Open wxfred opened 5 months ago

wxfred commented 5 months ago

Describe the bug

Run npm install video.js @videojs-player/vue --save Then run npm install, the error comes out

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @videojs-player/vue@1.0.0
npm ERR! Found: video.js@8.10.0
npm ERR! node_modules/video.js
npm ERR!   video.js@"^8.10.0" from the root project
npm ERR!   video.js@"^7 || ^8" from @videojs/http-streaming@3.10.0
npm ERR!   node_modules/@videojs/http-streaming
npm ERR!     @videojs/http-streaming@"3.10.0" from video.js@8.10.0
npm ERR!   1 more (videojs-contrib-quality-levels)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer video.js@"7.x" from @videojs-player/vue@1.0.0
npm ERR! node_modules/@videojs-player/vue
npm ERR!   @videojs-player/vue@"^1.0.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: video.js@7.21.5
npm ERR! node_modules/video.js
npm ERR!   peer video.js@"7.x" from @videojs-player/vue@1.0.0
npm ERR!   node_modules/@videojs-player/vue
npm ERR!     @videojs-player/vue@"^1.0.0" 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.

Reproduction

Run npm install video.js @videojs-player/vue --save Then run npm install, the error comes out

System Info

System:
  OS: Windows 10 10.0.19045
  CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
  Memory: 14.61 GB / 31.84 GB
Binaries:
  Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
  npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
Browsers:
  Chrome: 123.0.6312.122
npmPackages:
  @videojs-player/vue: ^1.0.0 => 1.0.0
  video.js: ^8.10.0 => 8.10.0

Used Package Manager

npm

Validations

mlanning commented 5 months ago

Although not the exact same issue, I ran into something that may help. When using npm workspaces and running npm install video.js @videojs-player/vue --save --workspace=my-workspace, it created an extra node_modules directory in my workspace. This is usually a sign of mismatched dependencies, so I investigated. After scanning though the package-lock.json file, it looks like @videojs-player/vue depends on video.js version ^6 || ^7. When I rolled back video.js to version ^7.0.0, everything worked as expected. Perhaps if you remove the current version ^8.10.0, and install "video.js": "^7.0.0" instead, it may solve your issue as well.