Ionic Build broken after updating CLI to latest version (3.10.3)

After my CLI automatically updated, I can run Ionic Serve fine but my project wont build or run on the device. I get the following error:

Error: Cannot find module '@angular/tsc-wrapped/src/tsc'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Projects\aviagen\aviagen-mobile\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:7:13)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

and my info:

cli packages: (C:\Projects\aviagen\aviagen-mobile\node_modules)

    @ionic/cli-utils  : 1.10.2
    ionic (Ionic CLI) : 3.10.3

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 2.0.2
    Cordova Platforms  : android 6.2.3 ios 4.4.0 windows 4.4.2
    Ionic Framework    : ionic-angular 3.5.3

System:

    Node : v6.11.1
    npm  : 5.4.2
    OS   : Windows 10

This is a list of things I have already tried after searching about for someone with the same problem. None of these things have helped me and I still get the same error. Anyone have any more ideas?

  • remove node_modules and npm install
  • npm install npm@latest -g
  • npm uninstall -g angular-cli
  • npm install -g angular-cli@latest
  • npm install --save-dev @angular/tsc-wrapped
  • npm cache clean --force
  • remove node_modules and npm install (again)

Any chance you could try with a blank project and try building?

ionic start BlankProject
cd BlankProject
ionic serve

I just tried this - when I did Ionic Serve and it started installing the project dependencies for the first time I got this error

[11:08:21]  Failed to read the projects ionic.config.json file: Unexpected end of JSON input
Error: tsconfig: Cannot read file 'C:\Projects\BlankProject\tsconfig.json': ENOENT: no such file or directory, open 'C:\Projects\BlankProject\tsconfig.json'.
    at BuildError.Error (native)
    at new BuildError (C:\Projects\BlankProject\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)
    at getTsConfig (C:\Projects\BlankProject\node_modules\@ionic\app-scripts\dist\transpile.js:296:15)
    at Object.<anonymous> (C:\Projects\BlankProject\node_modules\@ionic\app-scripts\dist\transpile.js:281:46)
    at step (C:\Projects\BlankProject\node_modules\@ionic\app-scripts\dist\transpile.js:32:23)
    at Object.next (C:\Projects\BlankProject\node_modules\@ionic\app-scripts\dist\transpile.js:13:53)
    at C:\Projects\BlankProject\node_modules\@ionic\app-scripts\dist\transpile.js:7:71
    at __awaiter (C:\Projects\BlankProject\node_modules\@ionic\app-scripts\dist\transpile.js:3:12)
    at Object.getTsConfigAsync (C:\Projects\BlankProject\node_modules\@ionic\app-scripts\dist\transpile.js:278:12)
    at validateRequiredFilesExist (C:\Projects\BlankProject\node_modules\@ionic\app-scripts\dist\build.js:53:21)

That sounds a little more detrimental and something more to do with your computer rather than your project.

Here’s 3 suggestions for the price of… well none - no charge :stuck_out_tongue:

Suggestion 1
Can you try reinstalling ionic see how that gets on?

npm -g ionic

Suggestion 2
Also you might need to clear our your global node modules folder (or at the very least rename it)

You can get the path of it from running the following command:

npm ls -gp

Suggestion 3
And the final nitpick - Node’s latest LTS version is v6.11.3 - cannot hurt to be on the latest :slight_smile:

So I’ve tried all your suggestion but still getting the same error in my project “Error: Cannot find module ‘@angular/tsc-wrapped/src/tsc’” :persevere:

I do however have a working new blank project (I tried npm install -g typescript ) and my new blank project seems to run. So I can only think of trying to migrate my non-working project into this new one. And if all else fails - take a copy of the working project and rollback the versions. Otherwise, im stuck.

Update: I seem to be in a place where my project is now running. I had to downgrade my NPM version so it may be that something is conflicting with the newest NPM. My current Ionic Info for my working project now looks like this…

cli packages: (C:\Projects\aviagen\aviagen-mobile\node_modules)

    @ionic/cli-utils  : 1.10.2
    ionic (Ionic CLI) : 3.10.3

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 2.0.2
    Cordova Platforms  : android 6.2.3 ios 4.4.0 windows 4.4.2
    Ionic Framework    : ionic-angular 3.5.3

System:

    Node : v6.11.3
    npm  : 4.2.0
    OS   : Windows 10

Hi German,

I have the same problem after update my ionic app from 3.3.0 to 3.9.2

Did you solve it?

Can you run Ionic Info and post?

Finally I could solve it. I created a new project with “ionic start” and replace my www\manifest.json, www\service-worker.js and www\index.html by the new ones.

Thanks anyway

Hello,

maybe the replacement itself doesn’t fix the error, because everything inside www folder should/could replaced by building the app. I have often the issue that build doesn’t update correct. In this case, among other things, I delete content of www folder.

Best regards, anna-liebt