我正在使用此指南使用Angularfire2和firebase创建Angular 4项目:
https://github.com/angular/angularfire2
当我安装所有内容并尝试运行“ ng serve”时,将出现以下错误提示:
./src/app/app.component.ts中的错误
找不到模块:错误:无法解析“ ......”中的“ angularfire2”
我看到了更多的人遇到这个问题,但是我的回答对我没有帮助。
我正在使用Angular 4,我的package.json看起来像这样:
{
"name": "xxxxxxx",
"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.0.1",
"@angular/common": "^4.0.1",
"@angular/compiler": "^4.0.1",
"@angular/compiler-cli": "^4.0.1",
"@angular/core": "^4.0.1",
"@angular/forms": "^4.0.1",
"@angular/http": "^4.0.1",
"@angular/platform-browser": "^4.0.1",
"@angular/platform-browser-dynamic": "^4.0.1",
"@angular/platform-server": "^4.0.1",
"@angular/router": "^4.0.1",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"typescript": "^2.2.2",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.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.2.0"
}
}
有人看到这个错误的原因以及如何解决吗?
最佳答案
我认为是因为Firebase本身未正确安装。
这为我做到了:
npm install firebase angularfire2-保存