Thi*_*ana 14 typescript angular angular-ivy angular11
我在我的机器上使用 angular 11.2,我想运行一个 angular 12 项目。从 git 克隆后,我运行了以下命令。
npm install
ng serve
但是我遇到了以下错误并且无法运行该项目。我读了这个问题,但它对我不起作用。
Error: ./src/main.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
TypeError: angularCompiler.getNextProgram is not a function
at C:\Users\thimira_p\Desktop\itrd\epic-itrda-web\node_modules\@ngtools\webpack\src\ivy\plugin.js:376:100
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: ./src/polyfills.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
TypeError: angularCompiler.getNextProgram is not a function
at C:\Users\thimira_p\Desktop\itrd\epic-itrda-web\node_modules\@ngtools\webpack\src\ivy\plugin.js:376:100
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: (webpack)-dev-server/client?http://0.0.0.0:0&sockPath=/sockjs-node
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
TypeError: angularCompiler.getNextProgram is not a function
at C:\Users\thimira_p\Desktop\itrd\epic-itrda-web\node_modules\@ngtools\webpack\src\ivy\plugin.js:376:100
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
我在使用自定义 webpack.config的 Angular 应用程序中遇到了同样的问题-@angular-builders/custom-webpack
作为依赖项。
Angular 和@angular-builders
主要版本应该匹配。
通过更新@angular-builders/custom-webpack
到最新版本解决:
npm install @angular-builders/custom-webpack@12.0.0
如果,在做安装后,你会得到这样的错误:
An unhandled exception occurred: Cannot find module 'webpack'
,尝试删除package-lock.json
和node_modules
,做一个干净的安装。
Github 问题:https : //github.com/just-jeb/angular-builders/issues/981
归档时间: |
|
查看次数: |
3848 次 |
最近记录: |