今天將寫的vue項(xiàng)目復(fù)制了一份(除node_modules)發(fā)到了另一個(gè)電腦上,在進(jìn)行npm install 命令的的時(shí)候一直報(bào)一個(gè)錯(cuò)誤"Unexpected end of JSON input while parsing near";
查閱資料后找了幾種解決辦法,大家可以嘗試嘗試
1、先強(qiáng)制清除緩存再執(zhí)行npm install
npm cache clean --force
npm install
2、有可能是node和npm版本不匹配造成的
npm install -g n //n是用來管理node版本的
//如果上面的命令執(zhí)行后報(bào)錯(cuò)了執(zhí)行下面的命令
npm install -g n --force
//然后再清除緩存
npm cache clean --force
npm install
我是用第二種方法才處理成功的。