这两天执行 npm install 时会报错误:
17971 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...ersion":"4.5.0","depe' 17971 verbose stack at JSON.parse (<anonymous>) 17971 verbose stack at parseJson (C:\Users\Administrator.CE-20151109NQJC\AppData\Roaming\npm\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17) 17971 verbose stack at C:\Users\Administrator.CE-20151109NQJC\AppData\Roaming\npm\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50 17971 verbose stack at runMicrotasks (<anonymous>) 17971 verbose stack at processTicksAndRejections (internal/process/task_queues.js:94:5) 17972 verbose cwd E:\workspaces\multiplatform 17973 verbose Windows_NT 6.1.7601 17974 verbose argv "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Administrator.CE-20151109NQJC\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" 17975 verbose node v12.14.1 17976 verbose npm v6.13.6 17977 error Unexpected end of JSON input while parsing near '...ersion":"4.5.0","depe' 17978 verbose exit [ 1, true ]
这个错误的解决方法有以下几种:
1.删掉package.lock.json
2.清除cache
npm cache clean --force
3.进入下面这个文件夹清除cache
路径:C:/Users/PC/AppData/Roaming/npm-cache
执行:
npm cache clean --force
4.不要用淘宝镜像。
npm set registry https://registry.npmjs.org/