当我将android平台添加到我的cordova项目时发生错误。希望有人能给我一点推力

时间:2015-05-28 03:40:44

标签: cordova npm

我是科尔多瓦的新学徒。我正在尝试构建跨平台混合应用程序。但是当我用cordova platform add android添加android平台时出现错误。我不知道如何处理它。

No version supplied. Retrieving version from config.xml...
npm http GET https://registry.npmjs.oorg/cordova-android/-/cordova-android-4.0.0.tgz
TypeError: Request path contains unescaped characters.
    at new CLient Request (_http_client.js:73:10)
    at Tunneling Agent.exports.request (http.js:49:10)
    at TunnelingAgent.createSocket(C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:117:25)
    at TunnelingAgent.createSecureSocket [as createSocket] (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:184:41)
    at TunnelingAgent.addRequest (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:80:8)
    at new ClientRequest (_http_client.js:154:16)
    at Object.exports.request (http.js:49:10)
    at Object.exports.request (https.js:136:15)
    at Request.start (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\index.js:594:30)
    at Request.end(C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\index.js:1186:28)

非常感谢。

1 个答案:

答案 0 :(得分:0)

可能有bug节点和CLI。建议的解决方案是:

首先,配置代理设置:

npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080

使用此邮政编辑替换tunnel-agent的内容 - tunnel-agent

您必须在2个地方找到您的tunnel-agent文件夹:

C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\request\node_modules\tunnel-agent

C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\request\node_modules\tunnel-agent

如果您使用的是32位系统但找不到Program Files (x86),请检查Program Files文件夹