角度-错误TS2307:找不到模块'ngx-bootstrap / modal'

时间:2018-11-23 05:40:18

标签: ngx-bootstrap ngx-bootstrap-modal

我已经使用命令ngx-bootstrap安装了npm install ngx-bootstrap --save,但是当我尝试构建其说明的解决方案时仍然如此

ERROR in src/app/app.module.ts(37,45): error TS2307: Cannot find module 'ngx-bootstrap/modal'

我已经检查了其中存在的node_modules文件夹ngx-bootstrap/modal

这是我的包裹

 {
  "name": "test-app",
  "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": "^5.1.0",
    "@angular/common": "^5.1.0",
    "@angular/compiler": "^5.1.0",
    "@angular/core": "^5.1.0",
    "@angular/forms": "^5.1.0",
    "@angular/http": "^5.1.0",
    "@angular/platform-browser": "^5.1.0",
    "@angular/platform-browser-dynamic": "^5.1.0",
    "@angular/router": "^5.1.0",
    "@ng-select/ng-select": "^1.6.3",
    "@ngx-translate/core": "^9.1.1",
    "@ngx-translate/http-loader": "^2.0.1",
    "angular2-jwt": "^0.2.3",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "intl": "^1.2.5",
    "jquery": "^3.3.1",
    "moment": "^2.22.2",
    "ng2-select2": "^1.0.0-beta.16",
    "ngx-bootstrap": "^3.1.2",
    "ngx-drag-and-drop-lists": "1.1.3",
    "ngx-logger": "^3.1.0",
    "ngx-moment": "^3.1.0",
    "ngx-mydatepicker": "^2.4.9",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular/cli": "^1.5.6",
    "@angular/compiler-cli": "^5.1.0",
    "@angular/language-service": "^5.1.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-cli": "~1.0.1",
    "karma-coverage": "^1.1.2",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-junit-reporter": "^1.2.0",
    "karma-phantomjs-launcher": "^1.0.4",
    "node-sass": "^4.9.0",
    "phantomjs": "^2.1.7",
    "protractor": "^5.3.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3"
  }
}

任何人都可以帮忙

2 个答案:

答案 0 :(得分:2)

尝试此“ npm install ngx-bootstrap@2.0.5 --save”,它可能会起作用!

答案 1 :(得分:0)

我花了将近一天的时间来解决这个问题。请使用此解决方案。

运行“npm install ngx-bootstrap --save”然后运行“npm install”

它会自动解决这个问题,你的应用程序就会运行。