cordova plugin add出现CERT_UNTRUSTED错误解决方法

介绍

           目前使用ionic+cordova完成hybmid app开发,在安装geolocation插件时爆出来一个莫名的错误:

Fetching from npm failed: CERT_UNTRUSTED
Error: CERT_UNTRUSTED
    at SecurePair.<anonymous> (tls.js:1367:32)
    at SecurePair.emit (events.js:92:17)
    at SecurePair.maybeInitFinished (tls.js:979:10)
    at CleartextStream.read [as _read] (tls.js:471:13)
    at CleartextStream.Readable.read (_stream_readable.js:340:10)
    at EncryptedStream.write [as _write] (tls.js:368:25)
    at doWrite (_stream_writable.js:225:10)
    at writeOrBuffer (_stream_writable.js:215:5)
    at EncryptedStream.Writable.write (_stream_writable.js:182:11)
    at write (_stream_readable.js:601:24)

         原因是因为我自己重新设置了npm仓库为淘宝的npm镜像仓库,由于某些安全原因无法获取cordova的相关插件,解决办法很简单:

npm config set strict-ssl false

以上。

posted @ 2015-05-29 18:42  royalrover  阅读(1179)  评论(0编辑  收藏  举报