0

ERROR in Could not resolve module @angular/core

I create Ionic App and while I run it that gives the above error

my tsconfig look like below:

  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "esnext",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ],
    "paths": {
      "@shared/*": [
        "src/app/shared/*"
      ]
    }
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}```

error while running app

2 Answers 2

1

mostly this kind of error happens if there is a problem in paths. correcting the paths fixed the above issue. or you can simply, if you have another project open that and u can open tsconfig.json then copy all data and paste that in your project error . solved if you don't have another project create one then try to do above.

Sign up to request clarification or add additional context in comments.

Comments

1

I solved the problem. I didn't need to touch my packages at all. My tsconfig.json was corrupt for some weird reason. I restored it, removed the node_modules, deleted package-lock.json and run npm run install.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.