运行 ng serve 时找不到模块“@angular/compiler-cli/ngc”
Posted
技术标签:
【中文标题】运行 ng serve 时找不到模块“@angular/compiler-cli/ngc”【英文标题】:cannot find module '@angular/compiler-cli/ngc' when I run ng serve 【发布时间】:2020-05-22 17:48:21 【问题描述】:我的 package.json 文件
编号列表很容易
“名称”:“cal-euc”, “版本”:“0.0.0”, “脚本”: “ng”:“ng”, “开始”:“ng服务”, “构建”:“ng构建”, “测试”:“ng测试”, “lint”:“ng lint”, “e2e”:“ng e2e” , “私人”:真的, “依赖”: "@angular/animations": "^7.0.1", "@angular/common": "^7.0.1", "@angular/compiler": "^7.0.1", "@angular/core": "^7.0.1", "@angular/forms": "^7.0.1", "@angular/http": "^7.0.1", "@angular/platform-browser": "^7.0.1", "@angular/platform-browser-dynamic": "^7.0.1", "@angular/路由器": "^7.0.1", "core-js": "^2.5.4", "rxjs": "^6.0.0", "rxjs-compat": "^6.5.4", “zone.js”:“~0.8.26” , “开发依赖”: "@angular-devkit/build-angular": "^0.803.25", "@angular/cli": "^8.3.25", "@angular/compiler-cli": "^7.0.1", "@angular/language-service": "^7.0.1", "@types/jasmine": "~2.8.6", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", "codelyzer": "~4.2.1", “茉莉花核”:“~2.99.1”, “茉莉花规格报告者”:“〜4.2.1”, "业力": "^4.4.1", "karma-chrome-launcher": "~2.2.0", “karma-coverage-istanbul-reporter”:“~2.0.0”, “业力茉莉花”:“〜1.1.1”, “karma-jasmine-html-reporter”:“^0.2.2”, "量角器": "~5.4.0", "ts-node": "~5.0.1", "tslint": "~5.9.1", “打字稿”:“~3.1.3”
【问题讨论】:
欢迎使用 ***。请使用降价语法来格式化您的问题,并使其更具可读性。我已经编辑过了。还要多解释一点你的问题,而不仅仅是问题的标题。谢谢。 【参考方案1】:我有同样的问题。这是因为 angular-cli 版本大于 angular 版本并且 compiler-cli 不兼容。 我将 angular-cli 版本降级为 7,我的项目现在可以正常运行了。
我找不到任何其他解决方案。
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@7.3.9
问候
【讨论】:
您降级到 7 级的步骤是什么?你能在这里提供吗?以上是关于运行 ng serve 时找不到模块“@angular/compiler-cli/ngc”的主要内容,如果未能解决你的问题,请参考以下文章
运行 gulp app:serve rails 时找不到模块“require-dir”错误
ng serve 命令需要在 Angular 项目中运行,但找不到项目定义
UnhandledPromiseRejectionWarning:错误:当我尝试运行我的代码时找不到模块'../database/db'