当前位置: 首页 > 工具软件 > npm-upgrade > 使用案例 >

vue运行之神奇的npm install --legacy-peer-deps

蒙弘图
2023-12-01

网上找个例子,运行的时候各种冲突,各种报错,折腾了快一天都没跑起来。直到遇到了神奇的npm install --legacy-peer-deps 指令才成功。记录如下:

C:\workspace\vue2-happyfri>npm install
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: happyfri@1.0.2
npm ERR! Found: less@3.13.1
npm ERR! node_modules/less
npm ERR!   dev less@"^3.9.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer less@"^2.3.1" from less-loader@2.2.3
npm ERR! node_modules/less-loader
npm ERR!   dev less-loader@"^2.2.3" 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 C:\Users\Administrator\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Local\npm-cache\_logs\2022-08-26T08_32_12_224Z-debug-0.log

C:\workspace\vue2-happyfri>npm install --legacy-peer-deps
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN deprecated autoprefixer-loader@3.2.0: Please use postcss-loader instead of autoprefixer-loader
npm WARN deprecated babel-preset-es2015@6.24.1:   Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated extract-text-webpack-plugin@1.0.1: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm WARN deprecated html-webpack-plugin@2.30.1: out of support
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
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 svgo@0.7.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.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. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

added 911 packages, and audited 912 packages in 1m

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

60 vulnerabilities (3 low, 43 moderate, 12 high, 2 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

C:\workspace\vue2-happyfri>npm run serve
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! Missing script: "serve"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Local\npm-cache\_logs\2022-08-26T08_35_27_312Z-debug-0.log

C:\workspace\vue2-happyfri>npm run dev
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

> happyfri@1.0.2 dev
> node build/dev-server.js

Listening at http://localhost:8088

webpack built 2f6e185a6aaba8bf329d in 2690ms
Hash: 2f6e185a6aaba8bf329d
Version: webpack 1.15.0
Time: 2690ms
                    Asset       Size  Chunks             Chunk Names
       static/img/1-2.png    21.3 kB          [emitted]
       static/img/1-4.png    2.09 kB          [emitted]
       static/img/2-1.png    4.95 kB          [emitted]
       static/img/2-2.png    2.16 kB          [emitted]
       static/img/3-1.png    2.46 kB          [emitted]
static/img/WechatIMG2.png    1.75 kB          [emitted]
       static/img/1-1.jpg     111 kB          [emitted]
       static/img/4-1.jpg     130 kB          [emitted]
       static/img/4-2.png    11.2 kB          [emitted]
       static/img/4-3.png    4.19 kB          [emitted]
       static/img/4-4.png    3.98 kB          [emitted]
       static/img/5-1.png  209 bytes          [emitted]
       static/img/5-2.png    6.24 kB          [emitted]
                   app.js    2.09 MB       0  [emitted]  app
                1.item.js    57.1 kB       1  [emitted]  item
                2.home.js    57.3 kB       2  [emitted]  home
               3.score.js      31 kB       3  [emitted]  score
               index.html  674 bytes          [emitted]
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks       Chunk Names
    index.html  1.48 MB       0
webpack: Compiled successfully.

 类似资料: