错误的ERR!注册表错误解析json

时间:2015-01-11 01:20:55

标签: cordova npm

我正在开发一个小型Cordova v4.0.0项目,npm版本:v0.10.35 我正在添加一些插件,通常, 到现在为止,当我尝试添加另一个插件时,它会出错:

cordova plugin add org.apache.cordova.NetworkManager
Fetching plugin "org.apache.cordova.NetworkManager" via plugin registry
npm ERR! registry error parsing json
npm ERR! registry error parsing json
SyntaxError: Unexpected token I
Internal routing error

Sorry, we cannot connect to the intended server.

We have just been notified of this problem. We will correct it as soon as possible.

Feel free to contact us if you have any questions: support at iriscouch.com

    at Object.parse (native)
    at RegClient.<anonymous> (C:\Users\Tony\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\npm-registry-client\lib\request.js:274:23)
    at C:\Users\Tony\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\npm-registry-client\lib\request.js:251:7
    at Gunzip.onEnd (zlib.js:167:5)
    at Gunzip.emit (events.js:117:20)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:442:13)

在我试图解决这个问题时,我做了:

npm cache clean

我有一些由间谍软件安装的代理,我卸载了。 我已经清除了Windows代理设置和npm代理设置:

npm config rm proxy
npm config rm https-proxy

但它仍无效。

2015年1月12日更新:

cordova plugin add org.apache.cordova.NetworkManager
Fetching plugin "org.apache.cordova.NetworkManager" via plugin registry
Error: 404 Not Found: org.apache.cordova.NetworkManager
    at RegClient.<anonymous> (C:\Users\Tony\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\npm-registry-client\lib\request.js:304:14)
    at Request._callback (C:\Users\Tony\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\npm-registry-client\lib\request.js:246:65)
    at Request.self.callback (C:\Users\Tony\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\request.js:236:22)
    at Request.emit (events.js:98:17)
    at Request.<anonymous> (C:\Users\Tony\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\request.js:1142:14)
    at Request.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (C:\Users\Tony\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\request.js:1096:12)
    at IncomingMessage.emit (events.js:117:20)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:442:13)

替代解决方案是使用git:

cordova plugin add https://github.com/apache/cordova-plugin-network-information

Fetching plugin "https://github.com/apache/cordova-plugin-network-information" via git clone
Installing "org.apache.cordova.network-information" for android
Installing "org.apache.cordova.network-information" for windows

1 个答案:

答案 0 :(得分:6)

服务器没有响应。目前,您可以安装GitHub中的大多数插件,如下所示:

  

cordova插件添加https://github.com/apache/cordova-plugin-network-information

  

cordova插件添加https://github.com/apache/cordova-plugin-statusbar.git

请注意,由于插件之间的依赖关系以及必须根据具体情况需要解决的版本差异,可能会出现副作用。我们希望这不是一个长期问题。