问题“离子cordova build android --prod --release”

时间:2017-11-29 07:03:32

标签: angular typescript deployment ionic2 observable

我使用Ionic2创建了一个聊天应用程序。当我尝试使用ionic cordova build android --prod --release进行生产构建时,我收到以下错误。

    Error: ./node_modules/rxjs/observable/BoundCallbackObservable.js
Module build failed: TypeError: Cannot read property 'type' of undefined
    at Object.getEffectiveTypeAnnotationNode (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:9341:17)
    at assignContextualParameterTypes (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:41652:25)
    at checkFunctionExpressionOrObjectLiteralMethod (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:41948:29)
    at checkExpressionWorker (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:42959:28)
    at checkExpression (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:42898:42)
    at checkExpressionCached (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:42779:38)
    at checkReturnStatement (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:45418:54)
    at checkSourceElement (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:46763:28)
    at Object.forEach (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:1506:30)
    at checkBlock (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:44563:16)
 @ ./node_modules/rxjs/observable/bindCallback.js 2:32-68
 @ ./node_modules/rxjs/add/observable/bindCallback.js
 @ ./node_modules/rxjs/Rx.js
 @ ./src/providers/apis/apis.ts
 @ ./src/app/app.module.ngfactory.js
 @ ./src/app/main.ts,./node_modules/rxjs/observable/BoundNodeCallbackObservable.js
Module build failed: TypeError: Cannot read property 'type' of undefined
    at Object.getEffectiveTypeAnnotationNode (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:9341:17)
    at assignContextualParameterTypes (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:41652:25)
    at checkFunctionExpressionOrObjectLiteralMethod (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:41948:29)
    at checkExpressionWorker (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:42959:28)
    at checkExpression (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:42898:42)
    at checkExpressionCached (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:42779:38)
    at checkReturnStatement (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:45418:54)
    at checkSourceElement (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:46763:28)
    at Object.forEach (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:1506:30)
    at checkBlock (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\typescript\lib\typescript.js:44563:16)
 @ ./node_modules/rxjs/observable/bindNodeCallback.js 2:36-76
 @ ./node_modules/rxjs/add/observable/bindNodeCallback.js
 @ ./node_modules/rxjs/Rx.js
 @ ./src/providers/apis/apis.ts
 @ ./src/app/app.module.ngfactory.js
 @ ./src/app/main.ts
    at BuildError.Error (native)
    at new BuildError (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)
    at callback (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\@ionic\app-scripts\dist\webpack.js:121:28)
    at emitRecords.err (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\webpack\lib\Compiler.js:269:13)
at Compiler.emitRecords (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\webpack\lib\Compiler.js:375:38)
    at emitAssets.err (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\webpack\lib\Compiler.js:262:10)
    at applyPluginsAsyncSeries1.err (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\webpack\lib\Compiler.js:368:12)
    at next (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\tapable\lib\Tapable.js:218:11)
    at Compiler.compiler.plugin (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (C:\Users\cool\Desktop\Chat\SideMenu\node_modules\tapable\lib\Tapable.js:222:13)

离子信息

cli packages: (C:\Users\cool\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

全球套餐:

cordova (Cordova CLI) : 7.1.0

本地包裹:

@ionic/app-scripts : 3.1.0
Cordova Platforms  : android 6.3.0
Ionic Framework    : ionic-angular 3.9.2

系统:

Android SDK Tools : 26.1.1
Node              : v6.10.3
npm               : 3.10.10
OS                : Windows 8.1

请帮我解决这个错误。我见过一些类似的问题,但没有任何帮助我解决这个问题。

1 个答案:

答案 0 :(得分:6)

尝试@ Und3rTow

提到的文件中指定的以下步骤
npm install typescript@latest