Сбой ionic-app-script при сборке - Не удается найти модуль '@ angular / compiler-cli / ngtools2' - PullRequest
0 голосов
/ 21 февраля 2019

Только когда я создаю свое приложение для производства, я получаю ошибку Cannot find module '@angular/compiler-cli/ngtools2' на шаге build из ionic-app-script, после ionic cordova run android --prod

в моем файле package.jsonзависимость "@angular/compiler-cli": "^7.2.4", и глядя в мою папку node_modules я вижу @angular/compiler-cli/ngtools2.js

Почему ionic-app-script не может ее найти?

Полная ошибка:

$ ionic cordova run android --prod
> ionic-app-scripts build --prod --platform android
[10:08:45]  ionic-app-scripts 3.2.2 
[10:08:45]  build prod started ...
[10:08:45]  clean started ...
[10:08:45]  clean finished in 24 ms
[10:08:45]  copy started ...
[10:08:45]  deeplinks started ...
[10:08:45]  deeplinks finished in 84 ms
[10:08:45]  ngc started ...
[10:08:47]  ionic-app-script task: "build" 
[10:08:47]  Error: Cannot find module '@angular/compiler-cli/ngtools2' 
Error: Cannot find module '@angular/compiler-cli/ngtools2'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at C:\Users\User\AppData\Roaming\npm\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:206:90
    at <anonymous>
[ERROR] An error occurred while running subprocess ionic-app-scripts.

1 Ответ

0 голосов
/ 21 февраля 2019

Я решил эту проблему, обновив свои зависимости dev

  "devDependencies": {
    "@ionic/app-scripts": "^3.2.2",
    "typescript": "~2.4.2"
  },
...