使用npm安装gulp报错:unexpected end of json input while parsing near '...version'

169 阅读1分钟

unexpected end of json input while parsing near '...version'

今天用npm安装gulp时报了上面这个错,然后想着用cnpm安装gulp但是又报了另一个错:## randomUUID is not a function,最后在cnpm的issue中看到下面这条消息。

image.png

最后就将npm的镜像地址修改了一下,再去安装gulp就成功了,也没有切换node(v14.16.0)和npm(6.14.11)的版本

// 修改淘宝镜像地址
npm config set registry <https://registry.npmmirror.com/>

// 查看是否设置成功
npm config list