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