欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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

程序员文章站 2022-03-03 17:47:36
...

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

完美解决报错问题