npm 安装插件错误(“坑!~”)

npm  安装 插件 出现

npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to https://registry.npmjs.org/express failed, reason: unable to
 verify the first certificate

设置如下:npm config set strict-ssl false

-----------------------------------------------------------------------------------------------------

执行: npm cache clean --force

即可解决npm install出现”Unexpected end of JSON input while parsing near”错误。

以上是个人操作。网上具体操作如下:

1、如果你的项目里存在 package-lock.json 文件,删除它。并且删除 node_modules。然后再 npm install。

2、第一步不行的话。运行 npm cache clean --force 或者 npm cache verify 。然后再 npm install。

3、如果上面的都不行,就升级 npm 。 npm i -g npm
 

猜你喜欢

转载自blog.csdn.net/qq_25635139/article/details/88096039