noclist
noclist

Reputation: 1819

Module not found: Error: Can't resolve '@angular/localize/init' in '/usr/src/app/src'

I've added the @angular/localize package during an update from Angular 8 to 9. My polyfill.ts has the following import:

import '@angular/localize/init';

My app is compiling and spinning up fine on a browser locally but when I run a production build I'm getting the following error:

enter image description here

Any idea what isn't being resolved here? I can see the module installed correctly in the node_modules/@angular/localize directory.

Upvotes: 2

Views: 12800

Answers (2)

Andrey
Andrey

Reputation: 2078

Make sure that npm has installed appropriate version of @angular/localize! By default it installs the most latest, although for Angular 9 you need @angular/localize of version 9. That was the root cause of the issue in my case. This helped:

npm install --save @angular/[email protected]

Upvotes: 2

Bercove
Bercove

Reputation: 1175

Run this command in terminal if you are using npm

npm install @angular/localize --save

or if you are using Yarn

yarn add @angular/localize

Upvotes: 7

Related Questions