找不到模块"@ angular/core".在我的离子应用程序中 [英] Cannot find module '@angular/core'. in my ionic app

查看:60
本文介绍了找不到模块"@ angular/core".在我的离子应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个离子应用程序,但是当我添加一个新页面时,它给了我这个错误.

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

找不到模块'@ angular/core'

Cannot find module '@angular/core'

从'@ angular/core'导入{组件}时; 我检查了node_modules文件夹,未在@angular文件夹下找到核心文件夹. Ionic CLI版本:4.4.0

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

我尝试卸载npm并重新安装它,但是它不起作用.

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

Package.json文件:

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"
    ]
  }
}

推荐答案

我通过从项目中删除node_modules文件夹并再次运行npm install来解决此问题.

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

这篇关于找不到模块"@ angular/core".在我的离子应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆