一、原因:npm无法找到路径,路径错误,请详细查看路径,确保是在有packjson文件打开的。
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\DELL\Desktop\gt/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\DELL\Desktop\gt\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\DELL\AppData\Local\npm-cache\_logs\2023-07-21T02_24_35_383Z-debug-0.log
二、原因:因为vue@3.2.45和ruoyi@3.8.5不一样,版本不兼容,导致出错
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ruoyi@3.8.5
npm ERR! Found: vue@3.2.45
npm ERR! node_modules/vue
npm ERR! vue@"3.2.45" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^2.2.0" from @riophae/vue-treeselect@0.4.0
npm ERR! node_modules/@riophae/vue-treeselect
npm ERR! dev @riophae/vue-treeselect@"0.4.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.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\Users\DELL\AppData\Local\npm-cache\_logs\2023-07-21T02_28_42_945Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\DELL\AppData\Local\npm-cache\_logs\2023-07-21T02_28_42_945Z-debug-0.log
解决:
1.npm i --force 或者 npm i --legacy-peer-deps(强制性,可能会损坏)
2.修改vue版本和若依版本一致。在package.json文件中的dependencies和devDependencies修改版本(较为温和,可能会导致vue版本和其他内部elementplus、webpack等版本兼容问题,修改更多)