npm install 报错:Unexpected end of JSON input while parsing near '...wser # Runs the tests'

npm install 报错:Unexpected end of JSON input while parsing near '...wser # Runs the tests'

npm WARN tar ENOENT: no such file or directory, open '/home/workspace/cdp/deppon-test/devops-web/node_modules/.staging/xlsx-8f9eee71/dist/xlsx.full.min.map'
npm verb unlock done using /home/.npm/_locks/staging-3633c05fae5be15b.lock for /home/workspace/cdp/deppon-test/devops-web/node_modules/.staging
npm timing stage:rollbackFailedOptional Completed in 2ms
npm timing stage:runTopLevelLifecycles Completed in 103883ms
npm verb stack SyntaxError: Unexpected end of JSON input while parsing near '...wser # Runs the tests'
npm verb stack     at JSON.parse (<anonymous>)
npm verb stack     at parseJson (/usr/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
npm verb stack     at consumeBody.call.then.buffer (/usr/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
npm verb stack     at process._tickCallback (internal/process/next_tick.js:68:7)
npm verb cwd /home/workspace/cdp/deppon-test/devops-web
npm verb Linux 3.10.0-862.el7.x86_64
npm verb argv "/usr/bin/node" "/usr/bin/npm" "install" "-verbose"
npm verb node v10.15.3
npm verb npm  v6.4.1
npm ERR! Unexpected end of JSON input while parsing near '...wser # Runs the tests'
 

今天在构建Angular的时候,频繁报错,看原来的记录使用命令:(清缓存)

npm cache clean --force

并不好用.

经过多次验证发现,删除文件package-lock.json,

rm package-lock.json

 然后在执行:

npm install

完美解决报错问题

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值