Angular - 错误 TS2307:找不到模块 'ngx-bootstrap/modal'
Angular - error TS2307: Cannot find module 'ngx-bootstrap/modal'
我已经使用命令 npm install ngx-bootstrap --save
安装了 ngx-bootstrap
,但当我尝试构建解决方案时它仍然显示
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"
}
}
谁能帮忙
试试这个 npm install ngx-bootstrap@2.0.5 --save
它可能有用!
我花了将近一天的时间来解决这个问题。请使用此解决方案。
运行 "npm install ngx-bootstrap --save" 然后 运行 “npm 安装”
它会自动解决这个问题,你的应用程序会运行。
我已经使用命令 npm install ngx-bootstrap --save
安装了 ngx-bootstrap
,但当我尝试构建解决方案时它仍然显示
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"
}
}
谁能帮忙
试试这个 npm install ngx-bootstrap@2.0.5 --save
它可能有用!
我花了将近一天的时间来解决这个问题。请使用此解决方案。
运行 "npm install ngx-bootstrap --save" 然后 运行 “npm 安装”
它会自动解决这个问题,你的应用程序会运行。