question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to build ionic PWA with --prod flag

See original GitHub issue

Describe the bug The package worked great in development but when build for release. Error occurred:

$ npm run ionic:build --prod

pj5@0.0.1 ionic:build /Users/user1/Documents/git/tomorrow/web/myapp-zqr ionic-app-scripts build

[18:50:42] ionic-app-scripts 3.1.2 [18:50:42] build prod started … [18:50:42] clean started … [18:50:42] clean finished in 9 ms [18:50:42] copy started … [18:50:42] deeplinks started … [18:50:43] deeplinks finished in 268 ms [18:50:43] ngc started … [18:50:59] ngc finished in 16.25 s [18:50:59] preprocess started … [18:50:59] preprocess finished in less than 1 ms [18:50:59] webpack started … [18:50:59] copy finished in 16.86 s [18:52:48] ionic-app-script task: “build” [18:52:48] Error: ./node_modules/rxjs/observable/BoundCallbackObservable.js Module build failed: TypeError: Cannot read property ‘type’ of undefined at Object.getEffectiveTypeAnnotationNode (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:9341:18) at assignContextualParameterTypes (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:41652:25) at checkFunctionExpressionOrObjectLiteralMethod (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:41948:29) at checkExpressionWorker (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:42959:28) at checkExpression (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:42898:42) at checkExpressionCached (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:42779:38) at checkReturnStatement (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:45418:54) at checkSourceElement (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:46763:28) at Object.forEach (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:1506:30) at checkBlock (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/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 @ ./node_modules/@zxing/ngx-scanner/esm5/zxing-ngx-scanner.js @ ./src/pages/scan/scan.module.ngfactory.js @ ./src lazy @ ./node_modules/ionic-angular/util/ng-module-loader.js @ ./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 (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:9341:18) at assignContextualParameterTypes (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:41652:25) at checkFunctionExpressionOrObjectLiteralMethod (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:41948:29) at checkExpressionWorker (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:42959:28) at checkExpression (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:42898:42) at checkExpressionCached (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:42779:38) at checkReturnStatement (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:45418:54) at checkSourceElement (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:46763:28) at Object.forEach (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:1506:30) at checkBlock (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/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 @ ./node_modules/@zxing/ngx-scanner/esm5/zxing-ngx-scanner.js @ ./src/pages/scan/scan.module.ngfactory.js @ ./src lazy @ ./node_modules/ionic-angular/util/ng-module-loader.js @ ./src/app/app.module.ngfactory.js @ ./src/app/main.ts Error: ./node_modules/rxjs/observable/BoundCallbackObservable.js Module build failed: TypeError: Cannot read property ‘type’ of undefined at Object.getEffectiveTypeAnnotationNode (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:9341:18) at assignContextualParameterTypes (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:41652:25) at checkFunctionExpressionOrObjectLiteralMethod (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:41948:29) at checkExpressionWorker (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:42959:28) at checkExpression (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:42898:42) at checkExpressionCached (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:42779:38) at checkReturnStatement (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:45418:54) at checkSourceElement (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:46763:28) at Object.forEach (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:1506:30) at checkBlock (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/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 @ ./node_modules/@zxing/ngx-scanner/esm5/zxing-ngx-scanner.js @ ./src/pages/scan/scan.module.ngfactory.js @ ./src lazy @ ./node_modules/ionic-angular/util/ng-module-loader.js @ ./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 (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:9341:18) at assignContextualParameterTypes (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:41652:25) at checkFunctionExpressionOrObjectLiteralMethod (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:41948:29) at checkExpressionWorker (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:42959:28) at checkExpression (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:42898:42) at checkExpressionCached (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:42779:38) at checkReturnStatement (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:45418:54) at checkSourceElement (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:46763:28) at Object.forEach (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/typescript/lib/typescript.js:1506:30) at checkBlock (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/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 @ ./node_modules/@zxing/ngx-scanner/esm5/zxing-ngx-scanner.js @ ./src/pages/scan/scan.module.ngfactory.js @ ./src lazy @ ./node_modules/ionic-angular/util/ng-module-loader.js @ ./src/app/app.module.ngfactory.js @ ./src/app/main.ts at new BuildError (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28) at callback (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/@ionic/app-scripts/dist/webpack.js:121:28) at emitRecords.err (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/webpack/lib/Compiler.js:269:13) at Compiler.emitRecords (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/webpack/lib/Compiler.js:375:38) at emitAssets.err (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/webpack/lib/Compiler.js:262:10) at applyPluginsAsyncSeries1.err (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/webpack/lib/Compiler.js:368:12) at next (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/tapable/lib/Tapable.js:218:11) at Compiler.compiler.plugin (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4) at Compiler.applyPluginsAsyncSeries1 (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/tapable/lib/Tapable.js:222:13) at Compiler.afterEmit (/Users/user1/Documents/git/tomorrow/web/myapp-zqr/node_modules/webpack/lib/Compiler.js:365:9) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! pj5@0.0.1 ionic:build: ionic-app-scripts build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the pj5@0.0.1 ionic:build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/gf/.npm/_logs/2018-09-11T16_52_48_173Z-debug.log

My version: Angular CLI: 6.0.7 Node: 8.11.1 OS: darwin x64 Angular: 5.0.1 … common, compiler, compiler-cli, core, forms, http … platform-browser, platform-browser-dynamic

Package Version

@angular-devkit/architect 0.6.7 (cli-only) @angular-devkit/build-optimizer 0.0.32 @angular-devkit/core 0.6.7 (cli-only) @angular-devkit/schematics 0.6.7 (cli-only) @schematics/angular 0.6.7 (cli-only) @schematics/update 0.6.7 (cli-only) rxjs 5.5.2 typescript 2.4.2 webpack 3.6.0

Additional context Without --prod, it works.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lolaswiftcommented, Sep 13, 2018

@odahcam Great! Really appreciated!!. Please keep up the great work. Can you please close the issue?

0reactions
lock[bot]commented, Sep 14, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ionic PWA --prod flag not working - Stack Overflow
I have a strange problem,. When I build PWA in dev mode using this command: npm run ionic:build It works and build. But...
Read more >
Ionic5 prod build fails - Ionic Forum
I created a new Ionic 5 project. It doesn't have a lot in it. It works fine in development but when I run...
Read more >
Build a Progressive Web App (PWA) with Ionic Framework ...
Simplified 4 Steps to start PWA from build to production release using Firebase, ... prod flag minimizes and optimizes your entire project to...
Read more >
Angular Service Worker - Step-By-Step Guide
Learn all about the multiple PWA caching configuration options of the ngws-config.json file, build Progressive Web Apps using the Angular ...
Read more >
The Complete Guide To Progressive Web Apps with Ionic ...
Build the app again to include the new PWA features by using ionic build --prod , then start the http-server by running http-server...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found