Ionic serve getting old errors that were aready deleted

When I run ionic serve, ionic cordova run browser or anything else, I always get an old image at first. I get errors I already corrected or deleted. I dont know where they come from. Ive read ionic serve should fix it and rebuild everything, but its not. When I run ionic serve with livereload, i still get the errors. Then i resave my project and ionic rebuilds without errors!? Im not able to deploy to a device.

ionic cordova run build           
> cordova platform add build --save
Using cordova-fetch for build

Adding build project...

Unable to load PlatformApi from platform. Error [ERR_UNHANDLED_ERROR]: Unhandled error. (Does not appear to implement platform Api.)

(node:4084) [DEP0016] DeprecationWarning: 'GLOBAL' is deprecated, use 'global'
(node:4084) [DEP0025] DeprecationWarning: sys is deprecated. Use util instead.
(node:4084) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. (The platform "build" does not appear to be a valid cordova platform. It is missing API.js. build not supported.)
    at EventEmitter.emit (events.js:171:17)
    at EventEmitter.module.exports.emit (/usr/lib/node_modules/cordova/node_modules/cordova-common/src/events.js:71:17)
    at Object.getPlatformApiFunction (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/util.js:499:20)
    at /usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/platform/addHelper.js:187:52
    at _fulfilled (/usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
    at /usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30
    at Promise.promise.promiseDispatch (/usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:749:13)
    at /usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:557:44
    at flush (/usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:108:17)
    at process._tickCallback (internal/process/next_tick.js:61:11)
(node:4084) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4084) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Running app-scripts build: --platform build --target cordova
[20:03:42]  build dev started ... 
(node:4074) ExperimentalWarning: The fs.promises API is experimental
[20:03:42]  clean started ... 
[20:03:42]  clean finished in 1 ms 
[20:03:42]  copy started ... 
[20:03:42]  deeplinks started ... 
[20:03:42]  deeplinks finished in 59 ms 
[20:03:42]  transpile started ... 
[20:03:46]  typescript: src/models/journey.ts, line: 22 
            Cannot find name 'date'. 

      L21:  },
      L22:  departureDate: date,
      L23:  returnDate: date,

[20:03:46]  typescript: src/models/journey.ts, line: 23 
            Cannot find name 'date'. 

      L22:  departureDate: date,
      L23:  returnDate: date,
      L24:  car: {

[20:03:46]  typescript: src/pages/login/login.ts, line: 23 
            Cannot find name 'Loading'. 

      L22:      public loginForm: FormGroup;
      L23:      public loading: Loading;

[20:03:46]  typescript: src/providers/profile/profile.service.ts, line: 26 
            'const' declarations must be initialized. 

      L25:    getProfileInformation() : Observable<any>{
      L26:      const user;

[20:03:46]  typescript: src/providers/profile/profile.service.ts, line: 28 
            Cannot assign to 'user' because it is a constant or a read-only property. 

      L28:      user = firebase.auth().currentUser;
      L29:      if(user !== null){

[20:03:46]  typescript: src/providers/share/share.ts, line: 25 
            'const' declarations must be initialized. 

      L24:    setProfileInformation(){
      L25:      const user;

[20:03:46]  typescript: src/providers/share/share.ts, line: 27 
            Cannot assign to 'user' because it is a constant or a read-only property. 

      L27:      user = firebase.auth().currentUser;
      L28:      if(user !== null){

[20:03:46]  typescript: src/providers/user/user.service.ts, line: 40 
            Property 'profile' does not exist on type 'UserProvider'. 

      L39:        this.authState = currUser;
      L40:        this.profile =

[20:03:46]  typescript: src/validators/number.ts, line: 8 
            Cannot find name 'ValidatorFn'. 

       L8:    static number(prms = {}): ValidatorFn {
       L9:      return (control: FormControl): {[key: string]: string} => {

[20:03:46]  typescript: src/validators/number.ts, line: 18 
            Type '{ "number": boolean; }' is not assignable to type '{ [key: string]: string; }'. Property '"number"' is 
            incompatible with index signature. Type 'boolean' is not assignable to type 'string'. 

      L18:          return {"number": true};
      L19:        } else if(!isNaN(prms.min) && !isNaN(prms.max)) {

[20:03:46]  typescript: src/validators/number.ts, line: 19 
            Property 'min' does not exist on type '{}'. 

      L18:          return {"number": true};
      L19:        } else if(!isNaN(prms.min) && !isNaN(prms.max)) {

[20:03:46]  typescript: src/validators/number.ts, line: 19 
            Property 'max' does not exist on type '{}'. 

      L18:          return {"number": true};
      L19:        } else if(!isNaN(prms.min) && !isNaN(prms.max)) {

[20:03:46]  typescript: src/validators/number.ts, line: 21 
            Type '{ "number": boolean; }' is not assignable to type '{ [key: string]: string; }'. Property '"number"' is 
            incompatible with index signature. Type 'boolean' is not assignable to type 'string'. 

      L21:          return val < prms.min || val > prms.max ? {"number": true} : null;
      L22:        } else if(!isNaN(prms.min)) {

[20:03:46]  typescript: src/validators/number.ts, line: 21 
            Property 'min' does not exist on type '{}'. 

      L21:          return val < prms.min || val > prms.max ? {"number": true} : null;
      L22:        } else if(!isNaN(prms.min)) {

[20:03:46]  typescript: src/validators/number.ts, line: 21 
            Property 'max' does not exist on type '{}'. 

      L21:          return val < prms.min || val > prms.max ? {"number": true} : null;
      L22:        } else if(!isNaN(prms.min)) {

[20:03:46]  typescript: src/validators/number.ts, line: 22 
            Property 'min' does not exist on type '{}'. 

      L21:          return val < prms.min || val > prms.max ? {"number": true} : null;
      L22:        } else if(!isNaN(prms.min)) {

[20:03:46]  typescript: src/validators/number.ts, line: 24 
            Type '{ "number": boolean; }' is not assignable to type '{ [key: string]: string; }'. Property '"number"' is 
            incompatible with index signature. Type 'boolean' is not assignable to type 'string'. 

      L24:          return val < prms.min ? {"number": true} : null;
      L25:        } else if(!isNaN(prms.max)) {

[20:03:46]  typescript: src/validators/number.ts, line: 24 
            Property 'min' does not exist on type '{}'. 

      L24:          return val < prms.min ? {"number": true} : null;
      L25:        } else if(!isNaN(prms.max)) {

[20:03:46]  typescript: src/validators/number.ts, line: 25 
            Property 'max' does not exist on type '{}'. 

      L24:          return val < prms.min ? {"number": true} : null;
      L25:        } else if(!isNaN(prms.max)) {

[20:03:46]  typescript: src/validators/number.ts, line: 27 
            Type '{ "number": boolean; }' is not assignable to type '{ [key: string]: string; }'. Property '"number"' is 
            incompatible with index signature. Type 'boolean' is not assignable to type 'string'. 

      L27:          return val > prms.max ? {"number": true} : null;
      L28:        } else {

[20:03:46]  typescript: src/validators/number.ts, line: 27 
            Property 'max' does not exist on type '{}'. 

      L27:          return val > prms.max ? {"number": true} : null;
      L28:        } else {

Error: Failed to transpile program
    at new BuildError (/home/robin/webdevelopment/Trampr/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
    at /home/robin/webdevelopment/Trampr/node_modules/@ionic/app-scripts/dist/transpile.js:159:20
    at new Promise (<anonymous>)
    at transpileWorker (/home/robin/webdevelopment/Trampr/node_modules/@ionic/app-scripts/dist/transpile.js:107:12)
    at Object.transpile (/home/robin/webdevelopment/Trampr/node_modules/@ionic/app-scripts/dist/transpile.js:64:12)
    at /home/robin/webdevelopment/Trampr/node_modules/@ionic/app-scripts/dist/build.js:109:82

Hello,

maybe it helps to delete content of www and .sourcemaps folder.

Best regards, anna-liebt

Hey thanks. Same thing when I delete www directory. Im not seeing a .sourcemaps folder tho

Service worker active?

Hey Fluqz, i’m running into this exact problem too, did you happened to find a solution?

What do you mean by that? I do have some own provider/services running?

No not yet, what about you?

U have a service worker active? Enabled in index.html

Check progressive web app and service worker

They cache stuff which is hard to find

There is a serviceworker in my index file, but it is commented out and I found a service-worker.js
But i dont really know what to do

'use strict';
importScripts('./build/sw-toolbox.js');

self.toolbox.options.cache = {
  name: 'ionic-cache'
};

// pre-cache our key assets
self.toolbox.precache(
  [
    './build/main.js',
    './build/vendor.js',
    './build/main.css',
    './build/polyfills.js',
    'index.html',
    'manifest.json'
  ]
);

// dynamically cache any other local assets
self.toolbox.router.any('/*', self.toolbox.fastest);

// for any other requests go to the network, cache,
// and then only use that cached resource if your user goes offline
self.toolbox.router.default = self.toolbox.networkFirst;

Go to devtools
Tab application
Unregister all service workers

Uncommenting out in index wil not bring u anything if there is a sw already registered under the url

If there is no service worker active and the problem persist you know it is not a sw causing an issue

So the ypu need to look at the code and publish to the community if you need help