”Unexpected end of JSON input while parsing near”错误

Posted on 2020-09-04 09:16  LuckyCola  阅读(684)  评论(0)    收藏  举报

npm install style-loader css-loader -D

安装css-loader 和style-loader出现错误”Unexpected end of JSON input while parsing near”

执行npm cache clean --force 没用。

 解决方法如下

1、如果你的项目里存在 package-lock.json 文件,删除它。并且删除 node_modules。然后再 npm install。

2、第一步不行的话。运行 npm cache clean --force 或者 npm cache verify 。然后再 npm install。

3、如果上面的都不行,就升级 npm 。 npm i -g npm