Cannot find module '@angular/core'. in my

2019-07-29 12:40发布

I'm building an ionic app but when i added a new page it give me this error.

Cannot find module '@angular/core'

when import { Component } from '@angular/core'; I checked node_modules folder, i didn't found core folder under @angular folder. Ionic CLI version : 4.4.0

I tried to uninstall npm and reinstall it but it didn't work.

Package.json File :

    {
  "name": "fuberSims",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/cdk": "^5.2.4",
    "@angular/common": "4.1.3",
    "@angular/compiler": "4.1.3",
    "@angular/compiler-cli": "4.1.3",
    "@angular/core": "4.1.3",
    "@angular/forms": "4.1.3",
    "@angular/http": "4.1.3",
    "@angular/material": "^4.1.3",
    "@angular/platform-browser": "4.1.3",
    "@angular/platform-browser-dynamic": "4.1.3",
    "@ionic-native/camera": "^4.7.0",
    "@ionic-native/core": "4.4.0",
    "@ionic-native/device": "^4.5.3",
    "@ionic-native/diagnostic": "^4.7.0",
    "@ionic-native/email-composer": "^4.17.0",
    "@ionic-native/file": "^4.7.0",
    "@ionic-native/file-path": "^4.7.0",
    "@ionic-native/geolocation": "^4.5.3",
    "@ionic-native/location-accuracy": "^4.7.0",
    "@ionic-native/splash-screen": "4.4.0",
    "@ionic-native/status-bar": "^4.9.0",
    "@ionic-native/transfer": "^3.14.0",
    "@ionic/storage": "^2.1.3",
    "cordova-android": "7.0.0",
    "cordova-plugin-camera": "^4.0.2",
    "cordova-plugin-device": "^2.0.1",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-filepath": "^1.3.0",
    "cordova-plugin-geolocation": "^4.0.1",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^1.1.16",
    "cordova-plugin-request-location-accuracy": "^2.2.2",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova.plugins.diagnostic": "^4.0.8",
    "ionic-angular": "3.9.2",
    "ionic-scrolling-header": "^0.1.1",
    "ionicons": "3.0.0",
    "rxjs": "5.5.2",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.8",
    "typescript": "2.4.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
      },
      "cordova-plugin-camera": {},
      "cordova-plugin-file": {},
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-filepath": {},
      "cordova-plugin-request-location-accuracy": {},
      "cordova.plugins.diagnostic": {}
    },
    "platforms": [
      "android"
    ]
  }
}

标签: npm ionic4
1条回答
仙女界的扛把子
2楼-- · 2019-07-29 13:18

I solved this by delete node_modules folder from my project and run npm install again.

查看更多
登录 后发表回答