1

I get following error when try to compile ionic 3 app with ionic-view (www.ionicjs.com)

Error: Cannot find module '@angular/tsc-wrapped/src/tsc'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object. (/usr/src/app/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:7:13)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
npm info lifecycle MedMan@0.0.1~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! MedMan@0.0.1 build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the MedMan@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gitlab-runner/.npm/_logs/2017-09-25T14_14_22_583Z-debug.log
/snapshot.sh: line 32: [: missing `]'
npm run build failed
Make sure your project has a build script in the package.json
Failed to upload build to storage please retry your build.
Running after script...
$ clean-up
Cleaning up files...
Successful clean up
ERROR: Job failed: exit status 1

I work with following Versions:

"@angular/tsc-wrapped": "4.4.3",
"@ionic/cli-plugin-ionic-angular": "1.4.1"
"ionic": "3.12.0",
"rxjs": "^5.4.3",
"tslint": "^5.7.0",
"tslint-loader": "^3.5.3"

npm v 4.6.1
node v 8.5.0

None of the solutions at the web can solve this issue for me.

Mi Be
  • 431
  • 8
  • 18

2 Answers2

4

I guess this should fix it:

  • upgrade npm to the latest version (5.3.0), I personally stayed at 5.1.0 because there were issues with ionic and version 5.2.0 but I think it is fixed in the current version
  • rm -rf node_modules package-lock.json (on Windows: delete node_modules and package-lock.json manually)
  • npm install

If it still does not work you can try to manually install tsc-wrapped:

npm install --save-dev @angular/tsc-wrapped
David
  • 7,387
  • 3
  • 22
  • 39
  • this doesn't work for me (updated npm to 5.3.0, tsc-wrapped manually). I also tried: https://forum.ionicframework.com/t/cannot-find-angular-tsc-wrapped-while-doing-an-ionic-serve/97853/5 – Mi Be Sep 29 '17 at 10:48
  • Then reinstall node. – David Sep 29 '17 at 11:03
  • reinstallation doesn't help. Did this to deinstall node: https://stackoverflow.com/questions/9044788/how-do-i-uninstall-nodejs-installed-from-pkg-mac-os-x – Mi Be Sep 29 '17 at 12:18
  • Then either your system is toast or you made some mistake during installation. – David Sep 29 '17 at 13:11
  • I made a new ionic project and copied the files. Now it is working. – Mi Be Sep 29 '17 at 14:48
  • npm install --save-dev @angular/tsc-wrapped worked for me, thanks! – zuest Mar 15 '19 at 21:58
0

Try this:

npm install npm@latest -g
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@latest
npm install @angular/tsc-wrapped autoprefixer

https://github.com/angular/angular-cli/issues/3183#issuecomment-261740427

I additionally had to (but dont think this is only related to my case):

npm rebuild node-sass
David Smit
  • 829
  • 1
  • 13
  • 31