环境
操作系统:macOS Mojave Version 10.14.2
步骤
参考之前在windows上搭写的一篇记录
按照流程走到第六步,执行npm install
会报错
$ npm install
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm ERR! Unexpected end of JSON input while parsing near '...owserslist":"^4.4.1",'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nicole/.npm/_logs/2019-02-06T12_22_10_870Z-debug.log
stackoverflow的回答是这样的
It is possible your npm cache has a corrupted file, perhaps it partially downloaded something and then got an error. Try
npm cache clean --force
and see if that helps.
If that doesn’t help look in the log file given in the error message. Find the unexpected end of JSON input message in the log file and look before it to see if there are any other hints to the problem.
You updated your question with a new error message. That one is more specific about the corrupted file. Try removing thecli-1.5.5.tgz
file from the path specified and try again. If you are using a web proxy on your network then it is also possible that your proxy has stored a corrupted cache: if you are able then turn off any proxies configured for your system and try a direct download.
这里是 npm cache
的细节
于是执行了该命令就没问题啦~