Angular CLI无法找到模块

时间:2017-08-27 21:34:40

标签: angular npm angular-cli npm-install package.json

我已将项目复制到新存储库中。

然后我尝试删除node_modules文件夹,然后删除tape:

npm install 

安装缺少的依赖项

但是在安装之后,当我使用angular-CLI运行我的项目时,它找不到模块并显示这个错误:

ERROR in /home/haddad/projects/portfolio/src/app/app.component.ts (1,62): Cannot find module '@angular/core'.

ERROR in /home/haddad/projects/portfolio/src/app/app.component.ts (2,54): Cannot find module 'ngx-fullpage'.


ERROR in /home/haddad/projects/portfolio/src/app/menu-accueil/menu-accueil.component.ts (2,31): Cannot find module '@angular/material'.

这是我的 package.json

{
  "name": "siteperso",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.2.6",
    "@angular/cdk": "^2.0.0-beta.8",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/flex-layout": "^2.0.0-beta.8",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/material": "^2.0.0-beta.8",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "angular2-fontawesome": "^0.9.1",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "ngx-fullpage": "^4.0.6",
    "particlesjs": "^2.0.2",
    "roboto-fontface": "^0.8.0",
    "rxjs": "^5.1.0",
    "typed.js": "^2.0.2",
    "typeit": "^4.4.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.2.0",
    "@angular/compiler-cli": "^4.0.0",
    "@angular/language-service": "^4.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "angular-ide": "^0.9.29",
    "codelyzer": "~3.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.0.4",
    "tslint": "~5.3.2",
    "typescript": "~2.3.3"
  }
}

我还卸载了angular-cli,然后重新安装,但没有结果。

UPDATE ,我注意到丢失的模块是node_modules文件夹中@ped的锁定目录。

即使使用sudo chown -R ./node_modules/后我也遇到了相同的错误

0 个答案:

没有答案