无法解析 'angularfire2' - Angular 4
Can't resolve 'angularfire2' - Angular 4
我正在使用本指南使用 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 安装 firebase angularfire2 --save
我正在使用本指南使用 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 安装 firebase angularfire2 --save