1. 程式人生 > 其它 >vue專案建立完出現found 23 vulnerabilities (2 low, 16 moderate, 5 high),解決辦法

vue專案建立完出現found 23 vulnerabilities (2 low, 16 moderate, 5 high),解決辦法

found 23 vulnerabilities (2 low, 16 moderate, 5 high)
run npm audit fix to fix them, or npm audit for details

D:\myproject\yiyan_webauto
$ npm audit fix
npm ERR! code EAUDITNOPJSON
npm ERR! audit No package.json found: Cannot audit a project without a package.json

npm ERR! A complete log of this run can be found in:
npm ERR! D:\Program Files\nodejs\node_cache_logs\2022-03-01T04_21_12_141Z-debug.log

D:\myproject\yiyan_webauto
$ npm audit
npm ERR! code EAUDITNOPJSON
npm ERR! audit No package.json found: Cannot audit a project without a package.json

npm ERR! A complete log of this run can be found in:
npm ERR! D:\Program Files\nodejs\node_cache_logs\2022-03-01T04_21_18_162Z-debug.log

以上報錯是因為當前目錄沒有找到package.json ,cd到前端專案根目錄再執行即可

D:\myproject\yiyan_webauto\front (master -> origin)
$ npm audit fix
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

up to date in 5.064s

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

fixed 0 of 23 vulnerabilities in 1208 scanned packages
  2 package updates for 23 vulnerabilities involved breaking changes
  (use `npm audit fix --force` to install breaking changes; or refer to `npm audit` for steps to fix these manually)
更多學習筆記移步 https://www.cnblogs.com/kknote