ionic-team / ionic-app-scripts

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

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

Open Amadorval75 opened 5 years ago

Amadorval75 commented 5 years ago

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???

jcmmv00 commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

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

bitforth commented 5 years ago

@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 commented 5 years ago

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

bitforth commented 5 years ago

I found the solution to my particular case, it was in the config.xml file. The first two lines were wrong. If you're using git, use git bisect to find the commit that introduced the breaking change and revert config.xml to the last version it worked. That's what I did and my Android builds started to work. In my particular case, it was the <widget id=""> the line that was giving me troubles.

On Thu, Apr 25, 2019 at 5:10 AM Daniel Horta notifications@github.com wrote:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ionic-team/ionic-app-scripts/issues/1516#issuecomment-486585441, or mute the thread https://github.com/notifications/unsubscribe-auth/AA4GUMR5PQAIFGF27TKXFQDPSFYQTANCNFSM4G3DKDJA .

femi-Zedev commented 4 years ago

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 commented 4 years ago

Try this link https://inneka.com/programming/angular/property-finally-does-not-exist-on-type-promise/