在执行 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