在執行 npm audit fix命令時報錯:
npm ERR! code EAUDITNOPJSON
npm ERR! audit No package.json found: Cannot audit a project without a package.json
解決方案
意思是說沒有 package.json這個文件,新建一個:
npm init --yes
後面可能還會報錯
npm ERR! code EAUDITNOLOCK
npm ERR! audit Neither npm-shrinkwrap.json nor package-lock.json found: Cannot audit a project without a lockfile
npm ERR! audit Try creating one first with: npm i --package-lock-only
執行上面提到的命令
npm i --package-lock-only
原文鏈接:https://blog.csdn.net/talonzhang/article/details/88543497