問題概述
公司里的Jenkins構建某個前端項目一直報錯,查看日志發現是在 npm i 階段,錯誤如下:
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm ERR! Unexpected end of JSON input while parsing near '...RZ9vRZCK58maAT55SsyLT'
npm ERR! A complete log of this run can be found in:
npm ERR! /data/npm/node_cache/_logs/2020-06-22T09_56_13_966Z-debug.log
而在本地,或者其他機器上安裝都是正常的,說明代碼沒問題,最后懷疑是npm的緩存,查詢命令解決了問題
解救之法
清空npm的暫存
npm cache clean --force
