ionic-team / ionic-app-scripts

App Build Scripts for Ionic Projects
http://ionicframework.com/
MIT License
608 stars 303 forks source link

Prod builds throwing Error: The RegExp to find the DeepLinkConfigToken did not return valid data #1006

Open naveedahmed1 opened 7 years ago

naveedahmed1 commented 7 years ago

ionic cordova run android --prod is throwing below error:

Error: The RegExp to find the DeepLinkConfigToken did not return valid data

ionic info output

global packages:

    @ionic/cli-utils : 1.1.2
    Cordova CLI      : 7.0.1
    Ionic CLI        : 3.1.2

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.1.2
    @ionic/cli-plugin-ionic-angular : 1.1.2
    Ionic Framework                 : ionic-angular 3.2.1

System:

    Node       : v7.10.0
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
eydrian commented 7 years ago

I had the same error. I managed to fix byfixing all version, removing package-lock.json and reinstall all dependencies. My package.json looks the following

    "dependencies": {
        "@angular/common": "4.1.2",
        "@angular/compiler": "4.1.2",
        "@angular/compiler-cli": "4.1.2",
        "@angular/core": "4.1.2",
        "@angular/forms": "4.1.2",
        "@angular/http": "4.1.2",
        "@angular/platform-browser": "4.1.2",
        "@angular/platform-browser-dynamic": "4.1.2",
        "@angular/router": "^4.1.3",
        "@angular/tsc-wrapped": "^4.1.3",
        "@ionic-native/core": "3.10.2",
        "@ionic-native/keyboard": "^3.12.1",
        "@ionic-native/splash-screen": "3.10.2",
        "@ionic-native/status-bar": "3.10.2",
        "@ionic/storage": "2.0.1",
        "cordova-browser": "^4.1.0",
        "cordova-ios": "^4.4.0",
        "cordova-plugin-console": "^1.0.5",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.2",
        "cordova-plugin-whitelist": "^1.3.1",
        "ionic-angular": "3.3.0",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "rxjs": "5.1.1",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.11"
    },
    "devDependencies": {
        "@ionic/app-scripts": "1.3.7",
        "@ionic/cli-plugin-cordova": "1.3.0",
        "@ionic/cli-plugin-ionic-angular": "1.3.0",
        "typescript": "2.3.3"
    },

I hope that helps

aa-telali commented 7 years ago

I was getting the same error - using @angular v4.2.3 packages instead of v4.1.3 (which is what ionic required).

Downgraded the packages and all was well again! :0)

trakhimenok commented 7 years ago

Thanks @aa-telali - that helped to me. The error message could be more specific.

danielalvenstrand commented 7 years ago

@aa-telali i had to do a npm update in order to downgrade, else it would still install 4.2.4 even though i had locked to 4.1.3 in package.json

But it works! Thanks!!

jetav8r commented 7 years ago

Thanks for posting this. changing the package.json items back to 4.1.3 in there and doing an npm update fixed it for me as well... Thank you!

aa-telali commented 7 years ago

Glad I could save you some time 👍

jetav8r commented 7 years ago

This issue has reappeared with the upgrade to CLI 3.5... tried changing the package.json again, but it didn't work this time... I ran this command: ionic cordova build browser --prod --verbose It returned this information: [WARN] Error occurred during command execution from a CLI plugin(ionic/cli-plugin-cordova) [DEBUG] !!! ERROR ENCOUNTERED !!! Error: The RegExp to find the DeepLinkConfigToken did not return valid data [DEBUG] Error: The RegExp to find the DeepLinkConfigToken did not return valid data at new BuildError (C:\Users\me\WebstormProjects\app\node_modules\@ionic\app- scripts\dist\util\errors.js:16:28) at C:\Users\me\WebstormProjects\app\node_modules\@ionic\app- scripts\dist\preprocess.js:18:21

Any help resolving this issue would be greatly appreciated, as I can't publish to production at this time

tevenFr commented 7 years ago

Hi @jetav8r , you can run "npm run build --prod --parseDeepLinks false" for avoid this error. Also i don't know what it's gonna change to your app (maybe just the lazy loading)

jetav8r commented 7 years ago

Okay, thanks!

On Jul 24, 2017 8:27 AM, "Thibault" notifications@github.com wrote:

Hi @jetav8r https://github.com/jetav8r , you can run "npm run build --prod --parseDeepLinks false" for avoid this error. Also i don't know what it's gonna change to your app (maybe just the lazy loading)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ionic-team/ionic-app-scripts/issues/1006#issuecomment-317459790, or mute the thread https://github.com/notifications/unsubscribe-auth/AHmXxUyHPzFt41kLR91txnxxs7t-rKmpks5sRLf1gaJpZM4NkKgL .

nonamez commented 7 years ago

Same for me

cli packages: (/usr/lib/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.7.1

System:

Android SDK Tools : 25.2.5
Node              : v7.10.1
npm               : 4.2.0 
OS                : Linux 4.4

Misc:

backend : legacy
kyr0 commented 7 years ago

The issue lays in @ionic/app-scripts.

Hotfix:

npm install @ionic/app-scripts@3.0.0-201710070411

But there might be other versions that are working fine too. This is just the latest one and it works for me.

renepardon commented 7 years ago

The hotfix from @kyr0 also works for me. Great job!! :)

codercatdev commented 7 years ago

Well upgrading to @ionic/app-scripts@3.0.0-201710070411 doesn't allow for environment files and upgrading breaks my solution for environments. What is a guy to do ?? bitmoji

@danbucholtz I am using the @app/env solution. Any chance you could explain how to change to the new style further?

var path = require('path');
var useDefaultConfig = require('@ionic/app-scripts/config/webpack.config.js');

module.exports = function () {
  useDefaultConfig.resolve.alias = {
    "@app/env": path.resolve('./src/environments/environment' + (process.env.IONIC_ENV === 'prod' ? '' : '.' + process.env.IONIC_ENV) + '.ts')
  };

  return useDefaultConfig;
};

image

    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve",
        "ionic:serve:dev": "cross-env NODE_ENV=dev npm run ionic:serve",
        "ionic:serve:stage": "cross-env NODE_ENV=stage npm run ionic:serve",
        "ionic:serve:prod": "cross-env NODE_ENV=prod npm run ionic:serve",
        "ionic:build:dev": "cross-env NODE_ENV=dev ionic cordova build",
        "ionic:build:stage": "cross-env NODE_ENV=stage ionic cordova build --prod",
        "ionic:build:prod": "cross-env NODE_ENV=prod ionic cordova build --prod",
        "ionic:run:dev": "cross-env NODE_ENV=dev ionic cordova run",
        "ionic:run:stage": "cross-env NODE_ENV=stage ionic cordova run --prod",
        "ionic:run:prod": "cross-env NODE_ENV=prod ionic cordova run --prod"
    },
ShiChuanTaylors commented 7 years ago

Face the same issue as @ajonp

error message: TypeError: Cannot set property 'alias' of undefined

Any solution for this?

codercatdev commented 6 years ago

Here is the solution that is working https://github.com/ajonp/angularfire2-env-issue/blob/master/README.md