← Back to list

Ionic storage-angular error: Can’t resolve ‘@angular/common’ in storage-angular/fesm

I’m trying to use ionic/storage-angular in my ionic application. I was following the documentation…

Ted James · 2024-07-10 13:31 · 0 claps · 0.9 min read
#angular #ionic-framework #ionic3 #ionic-5 #ionic-storage
Open on Medium ↗
Wiki topics: RAG · RAG & Retrieval 🌐 · Web Development

Ionic storage-angular error: Can’t resolve ‘@angular/common’ in storage-angular/fesm

I’m trying to use ionic/storage-angular in my ionic application. I was following the documentation: https://github.com/ionic-team/ionic-storage.

I installed storage-angular (npm install @ionic/storage-angular) but I'm getting this error when importing IonicStorageModule in my app.module:

../../node_modules/@ionic/storage-angular/fesm2020/ionic-storage-angular.mjs:2:0–51 Error: Module not found: Error: Can’t resolve ‘@angular/common’ in ‘/home/<path_to_my_project>/node_modules/@ionic/storage-angular/fesm2020’

In app.module.ts I just did:

import { IonicStorageModule } from '@ionic/storage-angular';

imports: [ ... IonicStorageModule.forRoot()]

I’m using this version:

Ionic CLI                     : 7.2.0 (/home/baffo/.nvm/versions/node/v20.11.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 7.6.6
   @angular-devkit/build-angular : 17.1.1
   @angular-devkit/schematics    : 17.1.1
   @angular/cli                  : 17.1.1
   @ionic/angular-toolkit        : 9.0.0

I tried this solution, but didn’t work: https://stackoverflow.com/a/64717548/10946588

Solution

Well I don’t know how exactly I fixed it but:

  • I have a couple of warning complaining about ‘CommonJS or AMD dependencies’ so I added this to the angular.json (following this solution):
"projects": {
"app": {
"build": {
"options": {
"allowedCommonJsDependencies": [
"rxjs-compat",
"localforage"
],
  • I revert all the changes of package.json and package.json.lock and removed node_module folder.
  • Then, I reinstalled everything again:
npm install 
    npm install --save @ionic/storage
    npm install --save @ionic/storage-angular

And it’s working now.

Answered By — Baffer

Answer Checked By — Marilyn (FixIt Volunteer)

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0


메타데이터
post_id
6774320059cf
slug
ionic-storage-angular-error-cant-resolve-angular-common-in-storage-angular-fesm-6774320059cf
url
https://medium.com/@fixitblog/ionic-storage-angular-error-cant-resolve-angular-common-in-storage-angular-fesm-6774320059cf
canonical_url
https://medium.com/@fixitblog/ionic-storage-angular-error-cant-resolve-angular-common-in-storage-angular-fesm-6774320059cf
author_url
https://medium.com/@fixitblog
status
ok
fetched_at
2026-07-23 10:24:43