我想在Angular2 cli生成的项目中使用react-bootstrap-typeahead npm模块。现在,我对Angular很新,不知道我哪里出错了。我按照npm模块安装说明进行操作,但无法解决此问题。 任何人都知道该解决这个问题吗?
这是我的环境:
firebaseConnect
的package.json
@angular/cli: 1.0.0-rc.4
node: 6.9.5
os: win32 x64
@angular/common: 2.4.10
@angular/compiler: 2.4.10
@angular/core: 2.4.10
@angular/forms: 2.4.10
@angular/http: 2.4.10
@angular/platform-browser: 2.4.10
@angular/platform-browser-dynamic: 2.4.10
@angular/router: 3.4.10
@angular/cli: 1.0.0-rc.4
@angular/compiler-cli: 2.4.10
@ngtools/webpack: 1.2.3
我的app.module.ts
{
"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/common": "^2.4.0",
"@angular/compiler": "^2.4.0",
"@angular/core": "^2.4.0",
"@angular/forms": "^2.4.0",
"@angular/http": "^2.4.0",
"@angular/platform-browser": "^2.4.0",
"@angular/platform-browser-dynamic": "^2.4.0",
"@angular/router": "^3.4.0",
"core-js": "^2.4.1",
"react": "^15.2.0",
"react-bootstrap-typeahead": "^1.2.0",
"react-dom": "^15.2.0",
"rxjs": "^5.1.0",
"webpack": "^2.2.0-rc.3",
"webpack-dev-server": "^2.4.2",
"zone.js": "^0.7.6"
},
"devDependencies": {
"extract-text-webpack-plugin": "2.0.0-beta.5",
"webpack": "2.2.0-rc.3",
"@types/lodash": "4.14.50",
"@ngtools/webpack": "1.2.3",
"@angular/cli": "1.0.0-rc.4",
"@angular/compiler-cli": "^2.4.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.0.0"
}
}
命令行=>
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import {Typeahead} from 'react-bootstrap-typeahead';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
Typeahead
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
output =>
ng build
react-bootstrap-typeahead的文件结构:
ERROR in C:/dev/projects/test-app/src/app/app.module.ts (8,25): Cannot find module 'react-bootstrap-typeahead'.