_From @zengyufang on November 9, 2017 5:59_
Ionic version: (check one with "x")
(For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[ ] 3.x
I'm submitting a ... (check one with "x")
[ ] bug report
[ ] feature request
Please do not submit support requests or "How to" questions here. Instead, please use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
Expected behavior:
Steps to reproduce:
Related code:
insert short code snippets here

Other information:
I can't get the device information with the app I packaged with the release command,but debugger command is geted the device information,I don't know Why is that???and other bug of slides on android app used release command
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
insert the output from ionic info here

_Copied from original issue: ionic-team/ionic#13372_
_From @Sampath-Lokuge on November 9, 2017 6:8_
Do you need to release this app to store or just for debugging purpose?
_From @zengyufang on November 9, 2017 6:11_
yes,it's need to release to store
_From @Sampath-Lokuge on November 9, 2017 6:29_
You can run ionic doctor check and see the latest updates which you need to do and errors on your project.
_From @zengyufang on November 9, 2017 6:30_
hi, I don't know this relson,but I used command (ionic cordova build android --release) to build android app is ok. cound you tell me is why?
_From @zengyufang on November 9, 2017 6:36_
The command I used before was ionic cordova build android --release --prod,It's just compressed
_From @Sampath-Lokuge on November 9, 2017 6:48_
If you use ionic doctor check then it'll show any errors in your app. Run it and see that. This CLI is not for releasing the app. Just for checking errors and etc.
_From @zengyufang on November 9, 2017 7:0_
I'm sorry ,I didn't express myself clearly before.I used "ionic doctor check" to check errors.but before I'm used "ionic cordova build android --release --prod" build app can't get the device info, used"ionic cordova build android --release" build app can get the device info
_From @Sampath-Lokuge on November 9, 2017 7:13_
Why can't you test this in debug mode first on your device?
ionic cordova run android --prod --device
_From @gregor-srdic on November 9, 2017 16:35_
I am also having a problem building with --prod flag after updating to 3.9.2
here is the log:
ionic-app-scripts build --prod
[17:30:34] ionic-app-scripts 3.1.0
[17:30:34] build prod started ...
[17:30:34] clean started ...
[17:30:34] clean finished in 8 ms
[17:30:34] copy started ...
[17:30:34] deeplinks started ...
[17:30:34] deeplinks finished in 159 ms
[17:30:34] ngc started ...
[17:30:45] ngc finished in 10.81 s
[17:30:45] preprocess started ...
[17:30:45] preprocess finished in 2 ms
[17:30:45] webpack started ...
[17:30:45] copy finished in 11.56 s
[17:31:55] ionic-app-script task: "build"
[17:31:55] Error: ./node_modules/rxjs/observable/BoundNodeCallbackObservable.js Module build failed: TypeError: Cannot
read property 'type' of undefined at Object.getEffectiveTypeAnnotationNode
(C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:9341:17) at
assignContextualParameterTypes
(C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:41652:25) at
checkFunctionExpressionOrObjectLiteralMethod
(C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:41948:29) at
checkExpressionWorker (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:42959:28)
at checkExpression (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:42898:42) at
checkExpressionCached (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:42779:38)
at checkReturnStatement (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:45418:54)
at checkSourceElement (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:46763:28)
at Object.forEach (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:1506:30) at
checkBlock (C:\Nomnio\Gregor\360popusti\app\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/data-manager.ts @ ./src/app/app.module.ngfactory.js @
./src/app/main.ts,./node_modules/rxjs/observable/BoundCallbackObservable.js Module build failed: TypeError:
Cannot read property 'type' of undefined at Object.getEffectiveTypeAnnotationNode
(C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:9341:17) at
assignContextualParameterTypes
(C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:41652:25) at
checkFunctionExpressionOrObjectLiteralMethod
(C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:41948:29) at
checkExpressionWorker (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:42959:28)
at checkExpression (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:42898:42) at
checkExpressionCached (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:42779:38)
at checkReturnStatement (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:45418:54)
at checkSourceElement (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:46763:28)
at Object.forEach (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:1506:30) at
checkBlock (C:\Nomnio\Gregor\360popusti\app\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/data-manager.ts @ ./src/app/app.module.ngfactory.js @
./src/app/main.ts
Error: ./node_modules/rxjs/observable/BoundNodeCallbackObservable.js
Module build failed: TypeError: Cannot read property 'type' of undefined
at Object.getEffectiveTypeAnnotationNode (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:9341:17)
at assignContextualParameterTypes (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:41652:25)
at checkFunctionExpressionOrObjectLiteralMethod (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:41948:29)
at checkExpressionWorker (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:42959:28)
at checkExpression (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:42898:42)
at checkExpressionCached (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:42779:38)
at checkReturnStatement (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:45418:54)
at checkSourceElement (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:46763:28)
at Object.forEach (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:1506:30)
at checkBlock (C:\Nomnio\Gregor\360popusti\app\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/data-manager.ts
@ ./src/app/app.module.ngfactory.js
@ ./src/app/main.ts,./node_modules/rxjs/observable/BoundCallbackObservable.js
Module build failed: TypeError: Cannot read property 'type' of undefined
at Object.getEffectiveTypeAnnotationNode (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:9341:17)
at assignContextualParameterTypes (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:41652:25)
at checkFunctionExpressionOrObjectLiteralMethod (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:41948:29)
at checkExpressionWorker (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:42959:28)
at checkExpression (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:42898:42)
at checkExpressionCached (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:42779:38)
at checkReturnStatement (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:45418:54)
at checkSourceElement (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:46763:28)
at Object.forEach (C:\Nomnio\Gregor\360popusti\app\node_modules\typescript\lib\typescript.js:1506:30)
at checkBlock (C:\Nomnio\Gregor\360popusti\app\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/data-manager.ts
@ ./src/app/app.module.ngfactory.js
@ ./src/app/main.ts
at BuildError.Error (native)
at new BuildError (C:\Nomnio\Gregor\360popusti\app\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)
at callback (C:\Nomnio\Gregor\360popusti\app\node_modules\@ionic\app-scripts\dist\webpack.js:121:28)
at emitRecords.err (C:\Nomnio\Gregor\360popusti\app\node_modules\webpack\lib\Compiler.js:269:13)
at Compiler.emitRecords (C:\Nomnio\Gregor\360popusti\app\node_modules\webpack\lib\Compiler.js:375:38)
at emitAssets.err (C:\Nomnio\Gregor\360popusti\app\node_modules\webpack\lib\Compiler.js:262:10)
at applyPluginsAsyncSeries1.err (C:\Nomnio\Gregor\360popusti\app\node_modules\webpack\lib\Compiler.js:368:12)
at next (C:\Nomnio\Gregor\360popusti\app\node_modules\tapable\lib\Tapable.js:218:11)
at Compiler.compiler.plugin (C:\Nomnio\Gregor\360popusti\app\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (C:\Nomnio\Gregor\360popusti\app\node_modules\tapable\lib\Tapable.js:222:13)
Hello! Thank you for opening an issue with us!
Does anyone have a sample app demonstrating this issue that they can share via GitHub?
I am experiencing none of these issues, including on an app I just upgraded an app to Angular 5.0.1, Ionic Framework 3.9.2.
Also, I am going to move this to the Ionic CLI repo, but a sample application would still be very very helpful.
Thank you for using Ionic
I believe I have given you access to my bitbucket git repository, hope it doesn't waste your time.
https://[email protected]/gregor-srdic/discount360.git
@gregor-srdic - your issue seems to have something to do with the following line from data-manager.ts:
positionSubject = new BehaviorSubject<Geoposition>(null);
I am not sure where the actual issue exists (@ionic/app-scripts, TypeScript, rxjs?) but... if I modify that line to something like this:
positionSubject = null;
then the build works. The app probably doesn't work then, but the build itself does.
That is all I have found so far.
Your issue is probably different from @zengyufang's original issue.
Thanks a lot for your response, I don't think I would have thought of it myself. I will let you know if I get any useful info why this happens.
I have the same issue with rxjs when i run ionic build --prod after i upgrade to the version 3.9.2
upgrade typescript to 2.6.1 fix the bug for me
the bug is about rxjs with typescript , but the release log suggest us to use [email protected]
thanks @fengyundev updating to [email protected] also solved my issue!
it is not possible to use typescript 2.6.1 with angular5.0. Or did I miss something?
WARN @angular/[email protected] requires a peer of typescript@>=2.4.2 <2.5
What you mention is a warning - it might cause some unexpected behaviour I guess.
I was able to build --prod and run it, but didn't check in detail though.
On my side, I had to modify the import of Rxjs (commented line with import 'rxjs/Rx';, and added specific import resolved my issue)
Avoid import 'rxjs/Rx'
//import 'rxjs/Rx'; // adds ALL RxJS statics & operators to Observable
// Statics
import 'rxjs/add/observable/throw';
// Operators
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/distinctUntilChanged';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/observable/of';
import 'rxjs/add/observable/forkJoin';
import 'rxjs/add/operator/timeout;
See --build-optimizer errors "Cannot read property 'type' of undefined"
and it avoids loading all Rxjs
I receive the error when building with --prod flag (ionic).
Error: ./node_modules/rxjs/observable/BoundNodeCallbackObservable.js
Module build failed: TypeError: Cannot read property 'type' of undefined
at Object.getEffectiveTypeAnnotationNode (D:\tmp\ionic2\ezpart-mobile-svn\no
de_modules\typescript\lib\typescript.js:9341:17)
at assignContextualParameterTypes (D:\tmp\ionic2\ezpart-mobile-svn\node_modu
les\typescript\lib\typescript.js:41652:25)
at checkFunctionExpressionOrObjectLiteralMethod (D:\tmp\ionic2\ezpart-mobile
-svn\node_modules\typescript\lib\typescript.js:41948:29)
at checkExpressionWorker (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\types
cript\lib\typescript.js:42959:28)
at checkExpression (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\typescript\
lib\typescript.js:42898:42)
at checkExpressionCached (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\types
cript\lib\typescript.js:42779:38)
at checkReturnStatement (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\typesc
ript\lib\typescript.js:45418:54)
at checkSourceElement (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\typescri
pt\lib\typescript.js:46763:28)
at Object.forEach (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\typescript\l
ib\typescript.js:1506:30)
at checkBlock (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\typescript\lib\t
ypescript.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/loginProvider.ts
@ ./src/app/app.module.ngfactory.js
@ ./src/app/main.ts,./node_modules/rxjs/observable/BoundCallbackObservable.js
Module build failed: TypeError: Cannot read property 'type' of undefined
at Object.getEffectiveTypeAnnotationNode (D:\tmp\ionic2\ezpart-mobile-svn\no
de_modules\typescript\lib\typescript.js:9341:17)
at assignContextualParameterTypes (D:\tmp\ionic2\ezpart-mobile-svn\node_modu
les\typescript\lib\typescript.js:41652:25)
at checkFunctionExpressionOrObjectLiteralMethod (D:\tmp\ionic2\ezpart-mobile
-svn\node_modules\typescript\lib\typescript.js:41948:29)
at checkExpressionWorker (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\types
cript\lib\typescript.js:42959:28)
at checkExpression (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\typescript\
lib\typescript.js:42898:42)
at checkExpressionCached (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\types
cript\lib\typescript.js:42779:38)
at checkReturnStatement (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\typesc
ript\lib\typescript.js:45418:54)
at checkSourceElement (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\typescri
pt\lib\typescript.js:46763:28)
at Object.forEach (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\typescript\l
ib\typescript.js:1506:30)
at checkBlock (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\typescript\lib\t
ypescript.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/loginProvider.ts
@ ./src/app/app.module.ngfactory.js
@ ./src/app/main.ts
at BuildError.Error (native)
at new BuildError (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\@ionic\app-s
cripts\dist\util\errors.js:16:28)
at callback (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\@ionic\app-scripts
\dist\webpack.js:121:28)
at emitRecords.err (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\webpack\lib
\Compiler.js:269:13)
at Compiler.emitRecords (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\webpac
k\lib\Compiler.js:375:38)
at emitAssets.err (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\webpack\lib\
Compiler.js:262:10)
at applyPluginsAsyncSeries1.err (D:\tmp\ionic2\ezpart-mobile-svn\node_module
s\webpack\lib\Compiler.js:368:12)
at next (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\tapable\lib\Tapable.js
:218:11)
at Compiler.compiler.plugin (D:\tmp\ionic2\ezpart-mobile-svn\node_modules\we
bpack\lib\performance\SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (D:\tmp\ionic2\ezpart-mobile-svn\node_m
odules\tapable\lib\Tapable.js:222:13)
@ionic/cli-utils : 1.18.0
ionic (Ionic CLI) : 3.18.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
@ionic/app-scripts : 3.1.0
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 25.2.5
Node : v6.9.0
npm : 3.10.8
OS : Windows 7
Environment Variables:
ANDROID_HOME : C:\Users\anton\AppData\Local\Android\sdk
Misc:
backend : pro
did you try the solution above?
jeromeXoo, what solution ?
remove import 'rxjs/Rx';
and add specific import
my solution was to remove the import and add the specific import
from:
import { BehaviorSubject } from 'rxjs/Rx';
to:
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import 'rxjs/add/operator/first';
Most helpful comment
remove import 'rxjs/Rx';
and add specific import