ionic-app-script在构建时失败 - 无法找到模块'@ angular / compiler-cli / ngtools2'
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ionic-app-script在构建时失败 - 无法找到模块'@ angular / compiler-cli / ngtools2'相关的知识,希望对你有一定的参考价值。
只有当我正在构建我的应用程序到生产时,我在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:UsersUserAppDataRoaming
pm
ode_modules@ionicapp-scriptsdistaotaot-compiler.js:206:90
at <anonymous>
[ERROR] An error occurred while running subprocess ionic-app-scripts.
答案
我解决了更新我的dev依赖项的问题
"devDependencies": {
"@ionic/app-scripts": "^3.2.2",
"typescript": "~2.4.2"
},
以上是关于ionic-app-script在构建时失败 - 无法找到模块'@ angular / compiler-cli / ngtools2'的主要内容,如果未能解决你的问题,请参考以下文章