Note: for support questions, please use one of these channels:
https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/
When I run ionic cordova build android --prod it fails with error
Should create optimized for production android package
Steps to reproduce:
ionic cordova build android --prod
Running app-scripts build: --prod --iscordovaserve --externalIpRequired --nobrowser
[16:05:17] build prod started ...
[16:05:17] clean started ...
[16:05:17] clean finished in 2 ms
[16:05:17] copy started ...
[16:05:17] ngc started ...
[16:05:27] ngc finished in 9.72 s
[16:05:27] preprocess started ...
[16:05:27] deeplinks started ...
[WARN] Error occurred during command execution from a CLI plugin (@ionic/cli-plugin-cordova). Your plugins may be out of
date.
Error: The RegExp to find the DeepLinkConfigToken did not return valid data
Which @ionic/app-scripts version are you using?
Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
global packages:
@ionic/cli-utils : 1.4.0
Cordova CLI : 7.0.1
Ionic CLI : 3.4.0
local packages:
@ionic/app-scripts : 1.3.12
@ionic/cli-plugin-cordova : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.5.0
System:
Node : v6.10.0
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b
ios-deploy : 1.9.0
ios-sim : not installed
npm : 5.0.4
Which version of angular do you use ?
@tgensol 4.1.3
I only have this issue if I use angular 4.2.X, with 4.1.3 and the last ionic 1.3.5 I do not have it... :/
Same issue for me. Angular 4.2.4
global packages:
@ionic/cli-utils : 1.4.0
Cordova CLI : 7.0.1
Ionic CLI : 3.4.0
local packages:
@ionic/app-scripts : 1.3.8
@ionic/cli-plugin-cordova : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms : android 6.1.2 browser 4.1.0
Ionic Framework : ionic-angular 3.4.2
System:
Node : v8.0.0
OS : Linux 4.10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 5.0.3
Can you all run npm run ionic:build --prod please?
Does it give you the same output?
If so, can you run the same command with --verbose added at the end please and post the output (and your ionic info again plus your current package.json of the project) here?
error-output for npm run ionic:build --prod --verbose
[15:19:06] deeplinks started ...
[15:19:06] ionic-app-script task: "build"
[15:19:06] Error: The RegExp to find the DeepLinkConfigToken did not return valid data
Error: The RegExp to find the DeepLinkConfigToken did not return valid data
at new BuildError (<App>/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
at <App>/node_modules/@ionic/app-scripts/dist/preprocess.js:18:21
at <anonymous>
npm verb lifecycle @company/app@~ionic:build: unsafe-perm in lifecycle true
npm verb lifecycle @company/app@~ionic:build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:<App>/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/rafael/bin:/usr/local/java/jdk1.8.0_102/bin:/home/rafael/android-sdk-linux/tools:/home/rafael/android-sdk-linux/platform-tools:/home/rafael/android-sdk-linux/tools:/home/rafael/android-sdk-linux/platform-tools:/home/rafael/android-sdk-linux/tools:/home/rafael/android-sdk-linux/platform-tools
npm verb lifecycle @company/app@~ionic:build: CWD: <App>
npm info lifecycle @company/app@~ionic:build: Failed to exec ionic:build script
npm verb stack Error: @company/app@ ionic:build: `ionic-app-scripts build`
npm verb stack Exit status 1
npm verb stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
npm verb stack at emitTwo (events.js:125:13)
npm verb stack at EventEmitter.emit (events.js:213:7)
npm verb stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
npm verb stack at emitTwo (events.js:125:13)
npm verb stack at ChildProcess.emit (events.js:213:7)
npm verb stack at maybeClose (internal/child_process.js:887:16)
npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
npm verb pkgid @company/app@
npm verb cwd <App>
npm verb Linux 4.10.0-21-generic
npm verb argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "ionic:build" "--prod" "--verbose"
npm verb node v8.0.0
npm verb npm v5.0.4
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @company/app@ ionic:build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @company/app@ ionic:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
package.json
{
"name": "@company/app",
"author": "Company",
"description": "...",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"test-coverage": "ng test --code-coverage",
"test": "ng test"
},
"dependencies": {
"@angular/common": "^4.1.3",
"@angular/compiler": "^4.1.3",
"@angular/compiler-cli": "^4.1.3",
"@angular/core": "^4.1.3",
"@angular/forms": "^4.1.3",
"@angular/http": "^4.1.3",
"@angular/platform-browser": "^4.1.3",
"@angular/platform-browser-dynamic": "^4.1.3",
"@angular/tsc-wrapped": "^4.1.3",
"@ionic-native/core": "^3.12.1",
"@ionic-native/in-app-browser": "^3.12.1",
"@ionic-native/screen-orientation": "^3.12.1",
"@ionic-native/splash-screen": "^3.12.1",
"@ionic-native/status-bar": "^3.12.1",
"@ionic/storage": "2.0.1",
"amdefine": "^1.0.1",
"buffer-shims": "^1.0.0",
"cordova-android": "^6.1.2",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-headercolor": "^1.0.0",
"cordova-plugin-inappbrowser": "^1.7.1",
"cordova-plugin-screen-orientation": "^2.0.1",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.1",
"cordova-plugin-whitelist": "^1.3.1",
"ionic-angular": "^3.4.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"process-nextick-args": "^1.0.7",
"rxjs": "5.4.0",
"sw-toolbox": "3.6.0",
"web-animations-js": "^2.2.5",
"zone.js": "0.8.12"
},
"devDependencies": {
"@angular/cli": "^1.1.3",
"@angular/router": "^4.2.4",
"@ionic/app-scripts": "1.3.8",
"@ionic/cli-plugin-cordova": "1.4.0",
"@ionic/cli-plugin-ionic-angular": "1.3.1",
"@types/jasmine": "^2.5.53",
"@types/node": "^8.0.2",
"jasmine-core": "^2.6.4",
"jasmine-spec-reporter": "^4.1.1",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"typescript": "2.3.4"
},
"cordova": {
"platforms": [
"android"
],
"plugins": {
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-headercolor": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-screen-orientation": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {}
}
}
}
For ionic info see comment above yours.
same only happens with angular 4.2.x :
global packages:
@ionic/cli-plugin-proxy : 1.3.2
@ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Ionic CLI : 3.5.0
local packages:
@ionic/app-scripts : 2.0.1
@ionic/cli-plugin-cordova : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms : android 6.2.3 windows 5.0.0
Ionic Framework : ionic-angular 3.5.0
System:
Node : v6.10.3
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 5.2.0
This problems gets solved when we use angular 4.1.x.
But what if I want to use 4.2.x only. Is cordova lagging behind with the angular updates and there is no fix for this.
I need angular 4.2 as there are new animation functions.
Ionic is not ready for Angular 4.2 yet.
See the current base package.json for a ionic-angular 3.5 project:
https://github.com/ionic-team/ionic2-app-base/blob/9b39d206f2bc894931116161519a2eed2284fadf/package.json
Angular is pinned to 4.1.3 for a good reason.
So when is ionic going to update to support angular 4.2. As in A4.2 there are new animations features that I really want to use for my app.
No idea. Create an issue at https://github.com/ionic-team/ionic/issues - maybe someone else can already tell you how to make it work with angular 4.2
I created a PR for this last month :D https://github.com/ionic-team/ionic/pull/12000
Still waiting for the merge
Just downgrade angular to 4.1.3 and remove ^ symbol before 4.1.3 in package.json and issue will be resolved
My ionic info :-
cli packages: (D:\ej\ejohri-spare\node_modules)
@ionic/cli-utils : 1.12.0
ionic (Ionic CLI) : 3.12.0
global packages:
cordova (Cordova CLI) : 7.0.1
local packages:
@ionic/app-scripts : 2.1.4
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.6.1
System:
Android SDK Tools : 26.1.1
Node : v6.10.3
npm : 5.4.2
OS : Windows 7
Misc:
backend : legacy
My Angular Version:
@angular/cli: 1.4.3
node: 6.10.3
os: win32 x64
@angular/common: 4.4.3
@angular/compiler: 4.4.3
@angular/compiler-cli: 4.4.3
@angular/core: 4.4.3
@angular/forms: 4.4.3
@angular/http: 4.4.3
@angular/platform-browser: 4.4.3
@angular/platform-browser-dynamic: 4.4.3
@angular/cli: 1.4.3
typescript: 2.5.2
Error:-
D:\ej\ejohri-spare>ionic cordova build android --prod
[INFO] Running app-scripts build: --prod --platform android --target cordova
[15:02:34] build prod started ...
[15:02:34] clean started ...
[15:02:34] clean finished in 2 ms
[15:02:34] copy started ...
[15:02:34] ngc started ...
[15:02:51] ngc finished in 16.87 s
[15:02:51] preprocess started ...
[15:02:51] deeplinks started ...
Error: The RegExp to find the DeepLinkConfigToken did not return valid data
at BuildError.Error (native)
at new BuildError (D:\ej\ejohri-spare\node_modules\@ionic\app-scripts\dist\u
til\errors.js:16:28)
at D:\ej\ejohri-spare\node_modules\@ionic\app-scripts\dist\preprocess.js:18:
21
Please resolve my bugs
@cooldp007 Please don't post the same problem in multiple places. The community forum is enough: https://forum.ionicframework.com/t/how-to-solve-app-script-issue/107429/5
okay
sorry
It's related to the @ionic/app-scripts it's mostly under devDependency. You need to upgrade to 3.0.1.
ionic-angular 3.8.0 requires 4.4.4 anyway, so whoever suggesting it does not support, pls. install ionic, and check, instead of misguiding others.
New one needs vendor.js to be added before main.js in the index.html
Unfortunatelly @ionic-native-mocks/splash-screen and @ionic-native-mocks/status-bar requires angular 3.2.1, so it's not in sync with the latest product
I have a problem with webworker, which requires independent js file.
1, Webpack CommonsChunkPlugin works with appscript 2.0.4, after initiating a two lines JsonPMainTemplatePlugin bug fix (related to window.global).
2, appscript 3.0.1 does not work with CommonsChunkPlugin at the moment, at least not how 2.0.4 works. - the two line fix i cannot verify, but it seems to me there.
If you don't use webworker, i was able to build for 'prod' without issues
Pls.: note that i have extreme capabilities beyond a normal ionic app. I hope i figure out how to solve the chunk issues.
Did someone could fix this error?
Most helpful comment
error-output for
npm run ionic:build --prod --verbosepackage.json
For
ionic infosee comment above yours.