Module not found: Error: Can't resolve '@angular/localize/init' in Angular
Dung Do Tien Aug 27 2021 217
Hello Guys, I have a project with angular 11. It still works fine but today I fetch code from Git and run ng serve --o
but I get an error Module not found: Error: Can't resolve '@angular/localize/init'.
ERROR in ./src/polyfills.ts
Module not found: Error: Can't resolve '@angular/localize/init' in 'D:\Projects\Source\philkostse\Admin\DAG.APA.AdminClient\src'
ERROR in ./src/polyfills.ts
Module not found: Error: Can't resolve 'web-animations-js' in 'D:\Projects\Source\philkostse\Admin\DAG.APA.AdminClient\src'
This is my tsconfig.json
file:
{
"compileOnSave": false,
"compilerOptions": {
"importHelpers": true,
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "amd",
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
And my angular version
Angular CLI: 11.2.14
Node: 14.17.5
OS: win32 x64
Angular: 11.2.14
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1102.14
@angular-devkit/build-angular 0.1102.14
@angular-devkit/core 11.2.14
@angular-devkit/schematics 11.2.14
@angular/cdk 11.2.13
@angular/http 7.2.16
@angular/material 7.3.7
@schematics/angular 11.2.14
@schematics/update 0.1102.14
rxjs 6.6.7
typescript 4.1.6
Thanks for any suggestions.
Have 1 answer(s) found.
- N-8
Nguyen Truong Giang Aug 27 2021
I got the same error about Module not found: Error: Can't resolve '@angular/localize/init'. And I fixed it by change
"module": "amd"
toes2015
intsconfig.json
file.{ "compileOnSave": false, "compilerOptions": { "module": "es2015", // Change amd to es2015 "typeRoots": [ "node_modules/@types" ], "lib": [ "es2017", "dom" ] } }
I hope it helpful to use.
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.