Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.
This repository was archived by the owner on May 1, 2020. It is now read-only.

IONIC 4 build TypeError: Cannot read property 'replace' of null  #1516

Open

Description

@Amadorval75

Hi when i try to build ionic project o got this error.

ionic-app-scripts build --prod --target cordova --platform android
[12:26:14] ionic-app-scripts 3.2.2
[12:26:14] build prod started ...
[12:26:14] typescript error
Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom',
'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator',
'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol',
'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string',
'es2017.intl', 'esnext.asynciterable'.

[12:26:14] ionic-app-script task: "build"
[12:26:14] TypeError: Cannot read property 'replace' of null
TypeError: Cannot read property 'replace' of null
at Object.escapeHtml (/Users/amadorurielgimenez/Desktop/Proyectos/DinsValencia4/node_modules/@ionic/app-scripts/dist/util/helpers.js:253:10)
at generateCodeBlock (/Users/amadorurielgimenez/Desktop/Proyectos/DinsValencia4/node_modules/@ionic/app-scripts/dist/logger/logger-diagnostics.js:187:77)
at generateDiagnosticHtml (/Users/amadorurielgimenez/Desktop/Proyectos/DinsValencia4/node_modules/@ionic/app-scripts/dist/logger/logger-diagnostics.js:179:12)
at Array.map ()
at Object.printDiagnostics (/Users/amadorurielgimenez/Desktop/Proyectos/DinsValencia4/node_modules/@ionic/app-scripts/dist/logger/logger-diagnostics.js:15:39)
at getTsConfig (/Users/amadorurielgimenez/Desktop/Proyectos/DinsValencia4/node_modules/@ionic/app-scripts/dist/transpile.js:322:34)
at Object. (/Users/amadorurielgimenez/Desktop/Proyectos/DinsValencia4/node_modules/@ionic/app-scripts/dist/transpile.js:298:46)
at step (/Users/amadorurielgimenez/Desktop/Proyectos/DinsValencia4/node_modules/@ionic/app-scripts/dist/transpile.js:32:23)
at Object.next (/Users/amadorurielgimenez/Desktop/Proyectos/DinsValencia4/node_modules/@ionic/app-scripts/dist/transpile.js:13:53)
at /Users/amadorurielgimenez/Desktop/Proyectos/DinsValencia4/node_modules/@ionic/app-scripts/dist/transpile.js:7:71
[ERROR] An error occurred while running subprocess ionic-app-scripts.

    ionic-app-scripts build --prod --target cordova --platform android 
    exited with exit code 1.
    
    Re-running this command with the --verbose flag may provide more 
    information.

Ionic.info is:

Ionic:

ionic (Ionic CLI) : 4.10.3 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.4
@ionic/app-scripts : 3.2.2

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 8 other plugins)

System:

ios-deploy : 2.0.0
ios-sim : 5.0.13
NodeJS : v10.6.0 (/usr/local/bin/node)
npm : 6.8.0
OS : macOS Mojave
Xcode : Xcode 10.1 Build version 10B61

Please some help???

Activity

  1. jcmmv00 commented on Mar 7, 2019

    @jcmmv00

    I don't know why the new projects with Ionic 4 come's without app-scripts, may be it because there were migrated to the standard of Angular 6/7 or something like that. Now I've been testing a Ionic 4 new basic project but when I make a change in a scss file the page is completely full reload and this is wasting a lot of time. I tried install ionic-app-scripts and have the same issue.

  2. kensodemann commented on Mar 7, 2019

    @kensodemann

    @jcmmv00 - that depends on whether your new project is using Ionic v4 or v3. The v4 CLI supports both. In this case, the OP is using Ionic v3 (3.9.4 per their ionic info output), so ionic-app-scripts is used.

    In a v4 project, we follow the NG CLI project and build structure for @ionic/angular applications (similarily, @ionic/vue apps would follow the common vue CLI paradigms and @ionic/react would use the react structure, etc). Thus, no ionic-app-scripts, that package can finally be retired.

  3. NicolasBehra commented on Apr 2, 2019

    @NicolasBehra

    In my case, i had to delete the proxy part inside the ionic.config.json and uninstall the ionic-app-scripts plugin

    Hope it helps a little... :/

  4. skanciado commented on Apr 13, 2019

    @skanciado

    I found the problem! 👍 @NicolasBehra have the half part of the solution!.
    The problem is in the ionic.config.json file, probably you replace the ionic.config of one project of Ionic 3. The type field is "angular" , not "ionic-angular"

    This is my ionic.file.config:

    {
    "name": "appinya",
    "integrations": {
    "cordova": {}
    },
    "proxies": [
    {
    "path": "/xxxx",

      "proxyUrl": "http://xx.xx.xx"
    } 
    

    ],
    "type": "angular" <<==The error is here
    }
    ... probably you put type:"ionic-angular" 🤞

  5. azcdev commented on Apr 24, 2019

    @azcdev

    @skanciado my ionic.config.json looks exactly the same as yours and I'm still getting that error, it used to work and suddenly it stopped working.

  6. skanciado commented on Apr 25, 2019

    @skanciado

    Hi!, I found a new scenario. I writted the last post on the beginning of my first migration of Ionic 3 to Ionic 4. Now, I have a new perspective :D . First of all , chop off the proxies in ionic.config. This proxies not work in this file. Second, I propose put the proxy via this comand npm config set proxy http://proxy.company.com:8888

  7. azcdev commented on Apr 25, 2019

    @azcdev
  8. femi-Zedev commented on Dec 10, 2019

    @femi-Zedev

    I got the same error with ionic 3. I was trying to use promise.prototype.finally method and I had to add "es2018.promise" to compilerOptions in tsconfig.json. I'm stuck with the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions