在执行 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.youkuaiyun.com/talonzhang/article/details/88543497