Skip to content
This repository has been 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
Amadorval75 opened this issue Mar 1, 2019 · 9 comments
Open

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

Amadorval75 opened this issue Mar 1, 2019 · 9 comments

Comments

@Amadorval75
Copy link

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 ([email protected])
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???

@jcmmv00
Copy link

jcmmv00 commented Mar 7, 2019

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.

@kensodemann
Copy link
Member

@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.

@NicolasBehra
Copy link

NicolasBehra commented Apr 2, 2019

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... :/

@skanciado
Copy link

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" 🤞

@azcdev
Copy link

azcdev commented Apr 24, 2019

@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.

@skanciado
Copy link

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

@azcdev
Copy link

azcdev commented Apr 25, 2019 via email

@femi-Zedev
Copy link

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

@femi-Zedev
Copy link

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants