使用最新的cli构建离子2应用程序时出错

时间:2017-03-17 18:12:04

标签: cordova ionic2 ionic-cli

帮助!我绝望了......不能解决这个问题。构建时出错,请参阅下文。

ionic cordova:build platform android --debug
TypeError: Cannot read property 'private' of undefined
at inputs.filter (\node_modules\@ionic\cli-utils\dist\index.js:20826:31)
at Array.filter (native)
at BuildCommand.getCleanInputsForTelemetry (\node_modules\@ionic\cli-utils\dist\index.js:20825:18)
at BuildCommand. (\node_modules\@ionic\cli-utils\dist\index.js:20788:48)
at Generator.next ()
at fulfilled (\node_modules\@ionic\cli-utils\dist\index.js:20731:58)

我尝试更新不同的项目:

npm install -g cordova@latest
ionic platform update android@6.1.2
npm install @ionic/app-scripts@latest --save-dev

请帮忙!无法将我的应用投入生产!

问题:之前有没有人遇到过这个问题,并知道如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

我会确保您拥有最新版本的npm和node。

然后确保您拥有最新版本的Ionic(2.2)

为此,您应该更新package.json文件..

"dependencies": {
"@angular/common": "2.4.8",
    "@angular/compiler": "2.4.8",
    "@angular/compiler-cli": "2.4.8",
    "@angular/core": "2.4.8",
    "@angular/forms": "2.4.8",
    "@angular/http": "2.4.8",
    "@angular/platform-browser": "2.4.8",
    "@angular/platform-browser-dynamic": "2.4.8",
    "@angular/platform-server": "2.4.8",
    "@ionic/storage": "2.0.0",
    "ionic-angular": "2.2.0",
    "ionic-native": "2.4.1",
    "ionicons": "3.0.0",
    "rxjs": "5.0.1",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.7.2"
},
"devDependencies": {
    "@ionic/app-scripts": "1.1.4",
    "typescript": "2.0.9"
}

然后删除node_modules目录,然后运行:

npm install(或者可能是sudo npm install)

这应该更新所有内容并希望解决问题