0
votes

i got stuck on an issue after installing a cordova plugin and using "npm audit fix".

Now if im trying to serve my app, i get this message:

[ng] An unhandled exception occurred: Cannot find module '@angular/compiler-cli/ngcc' [ng] See "C:\Users\Jorden\AppData\Local\Temp\ng-1VnycD\angular-errors.log" for further details.

[ERROR] ng has unexpectedly closed (exit code 127).

The Ionic CLI will exit. Please check any output above for error details.

I tried many solutions i found, but none of these worked for me..

Here is the angular-errors.log:

[error] Error: Cannot find module '@angular/compiler-cli/ngcc'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (C:\Users\Jorden\Desktop\Ionic\myApp\node_modules@ngtools\webpack
\src\ngcc_processor.js:10:16)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (C:\Users\Jorden\Desktop\Ionic\myApp\node_modules@ngtools\webpack \src\angular_compiler_plugin.js:23:26)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)

And my package.json:

{ "name": "myApp", "version": "0.0.1", "author": "Ionic
Framework", "homepage": "https://ionicframework.com/", "scripts":
{
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e" }, "private": true, "dependencies": {
"@angular/common": "^7.2.2",
"@angular/core": "^7.2.2",
"@angular/forms": "^7.2.2",
"@angular/http": "^7.2.2",
"@angular/platform-browser": "^7.2.2",
"@angular/platform-browser-dynamic": "^7.2.2",
"@angular/router": "^7.2.2",
"@ionic-native/core": "^5.0.0",
"@ionic-native/in-app-browser": "^5.18.0",
"@ionic-native/social-sharing": "^5.14.0",
"@ionic-native/splash-screen": "^5.14.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^4.1.0",
"@ionic/storage": "^2.2.0",
"cordova-android": "^8.1.0",
"cordova-browser": "6.0.0",
"cordova-ios": "5.1.1",
"cordova-plugin-inappbrowser": "^3.1.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-x-socialsharing": "^5.6.0",
"cordova-sqlite-storage": "^3.3.0",
"core-js": "^2.5.4",
"es6-promise-plugin": "^4.2.2",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
"woocommerce-api": "^1.4.2",
"zone.js": "~0.8.29" }, "devDependencies": {
"@angular-devkit/architect": "^0.803.21",
"@angular-devkit/build-angular": "^0.803.21",
"@angular-devkit/core": "^7.3.9",
"@angular-devkit/schematics": "^8.3.21",
"@angular/cli": "^8.3.21",
"@angular/compiler": "~7.2.2",
"@angular/compiler-cli": "~7.2.2",
"@angular/language-service": "~7.2.2",
"@ionic/angular-toolkit": "~1.5.1",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.6.8",
"codelyzer": "~4.5.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.1.3",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~8.3.0",
"tslint": "~5.17.0",
"typescript": "~3.1.6" }, "description": "An Ionic project", "cordova": {
"plugins": {
"cordova-plugin-splashscreen": {},
"cordova-sqlite-storage": {},
"cordova-plugin-x-socialsharing": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-inappbrowser": {}
},
"platforms": [
"ios",
"android",
"browser"
] } }

Hope you guys can help me :)

1
Stop all running processes, remove node_modules, run npm install again .. check for any weird imports in your editorC_Ogoo
Everything done, still same Errormessage. Thank you anyways :)Blizzard
Did you try installing the module alone using npm i <moduleName>?Anand G
If i delete node_modules and try to use 'npm i @angular/compiler-cli/' , it says "error Could not install from "@angular\compiler-cli" as it does not contain a package.json file"Blizzard
Fixed it now by doing these steps: 1.Changing version of angular/compiler to 7.2.2 in devDependencies 2. Changing version of angular/compiler-cli to 7.2.2 in devDependencies 3. deleting package.json.lock 4.**npm uninstall @angular-devkit/build-angular** 5.**npm install @angular-devkit/[email protected]** Dont know if this a good solution..Blizzard

1 Answers

0
votes

For IONIC 4 the following downgrades worked for me.

npm i @angular-devkit/[email protected]
npm i @angular-devkit/[email protected]