我正在尝试从firebase获取数据。但我得到以下错误
node_modules/@firebase/database/dist/cjs/index.d.ts(16,35):错误TS7016:可能
找不到模块' @ firebase / app'的声明文件。 ' C:/用户/ Paandi /桌面
/Project/Demo/node_modules/@firebase/app/dist/cjs/index.js'隐含地有一个' a
NY'类型。
node_modules/@firebase/database/dist/cjs/src/api/Database.d.ts(3,44):错误TS70
16:无法找到模块' @ firebase / app'的声明文件。 ' C:/用户/磐安
di/Desktop/Project/Demo/node_modules/@firebase/app/dist/cjs/index.js'隐式
有一个'任何'类型。
node_modules/@firebase/database/dist/cjs/src/api/TransactionResult.d.ts(28,15):
错误TS2304:找不到名称' object'。
node_modules/@firebase/database/dist/cjs/src/api/onDisconnect.d.ts(42,27):错误
TS2304:找不到名称' object'。
node_modules/@firebase/database/dist/cjs/src/core/AuthTokenProvider.d.ts(16,52):
错误TS7016:找不到模块' @ firebase / app'的声明文件。 ' C:
/Users/Paandi/Desktop/Project/Demo/node_modules/@firebase/app/dist/cjs/index.js'
隐含地有一个“任何”的类型。
node_modules/@firebase/database/dist/cjs/src/core/Repo.d.ts(3,29):错误TS7016:
无法找到模块' @ firebase / app'的声明文件。 ' C:/用户/ Paandi /
Desktop/Project/Demo/node_modules/@firebase/app/dist/cjs/index.js'哈哈
是一个'任何'类型。
node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.d.ts(58,34):
错误TS2304:找不到名称' object'。
node_modules/@firebase/database/dist/cjs/src/core/snap/IndexMap.d.ts(20,51):错误
或TS2304:找不到名称'对象'。
node_modules/@firebase/database/dist/cjs/src/core/util/util.d.ts(136,75):错误
TS2304:找不到名称' object'。
node_modules / angularfire2 / auth / auth.d.ts(1,36):错误TS2307:找不到模块
' @火力/ AUTH-类型&#39 ;.
node_modules / angularfire2 / database / database.d.ts(1,34):错误TS2307:无法鳍
d module' @ firebase / database-types'。
node_modules / angularfire2 / database / interfaces.d.ts(1,67):错误TS2307:不能f
ind module' @ firebase / database-types'。
node_modules / angularfire2 / database / list / audit-trail.d.ts(3,30):错误TS2307:Ca
找不到模块' @ firebase / database-types'。
node_modules / angularfire2 / database / list / state-changes.d.ts(5,30):错误TS2307:
找不到模块' @ firebase / database-types'。
node_modules / angularfire2 / firebase.app.module.d.ts(3,38):错误TS2307:不能f
ind module' @ firebase / app-types'。
node_modules / angularfire2 / firebase.app.module.d.ts(4,30):错误TS2307:不能f
ind module' @ firebase / auth-types'。
node_modules / angularfire2 / firebase.app.module.d.ts(5,34):错误TS2307:不能f
ind module' @ firebase / database-types'。
node_modules / angularfire2 / firebase.app.module.d.ts(6,35):错误TS2307:不能f
ind module' @ firebase / messaging-types'。
node_modules / angularfire2 / firebase.app.module.d.ts(7,33):错误TS2307:不能f
ind module' @ firebase / storage-types'。
node_modules / angularfire2 / firebase.app.module.d.ts(8,35):错误TS2307:不能f
ind module' @ firebase / firestore-types'。
node_modules / angularfire2 / firestore / collection / changes.d.ts(1,59):错误TS2307:
找不到模块' @ firebase / firestore-types'。
node_modules / angularfire2 / firestore / collection / collection.d.ts(1,83):错误TS23
07:找不到模块' @ firebase / firestore-types'。
node_modules / angularfire2 / firestore / document / document.d.ts(1,65):错误TS2307:
找不到模块' @ firebase / firestore-types'。
node_modules / angularfire2 / firestore / firestore.d.ts(1,56):错误TS2307:不能f
ind module' @ firebase / firestore-types'。
node_modules / angularfire2 / firestore / interfaces.d.ts(2,80):错误TS2307:不能
找到模块' @ firebase / firestore-types'。
node_modules / angularfire2 / firestore / observable / fromRef.d.ts(1,75):错误TS2307:
找不到模块' @ firebase / firestore-types'。
错误的ERR!代码ELIFECYCLE
错误的ERR!错误2
错误的ERR! angular-quickstart@1.0.0 build:tsc -p src/
错误的ERR!退出状态2
错误的ERR!
错误的ERR!在angular-quickstart@1.0.0构建脚本中失败。
错误的ERR!这可能不是npm的问题。可能还有其他日志
ging输出上面。
npm ERR!可以在以下位置找到此运行的完整日志:
错误的ERR! C:\ Users \用户Paandi \应用程序数据\漫游\ NPM-cache_logs \ 2018-03-28T15_29_02
_103Z-的debug.log
错误的ERR!代码ELIFECYCLE
错误的ERR!错误2
错误的ERR! angular-quickstart@1.0.0 prestart:npm run build
错误的ERR!退出状态2
错误的ERR!
错误的ERR!在angular-quickstart@1.0.0预启动脚本中失败。
错误的ERR!这可能不是npm的问题。可能还有其他日志
ging输出上面。
npm ERR!可以在以下位置找到此运行的完整日志: 错误的ERR! C:\ Users \用户Paandi \应用程序数据\漫游\ NPM-cache_logs \ 2018-03-28T15_29_02 _227Z-的debug.log
我的system.config.js文件位于
之下/**
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
'app': 'app',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
defaultExtension: 'js',
meta: {
'./*.js': {
loader: 'systemjs-angular-loader.js'
}
}
},
rxjs: {
defaultExtension: 'js'
}
}
});
})(this);
我的tsconfig.json文件位于
之下{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"../node_modules/@types"
],
"types": [
"jasmine",
"firebase",
"node"
]
}
}
我的package.json文件在
下面{
"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"serve": "lite-server -c=bs-config.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
"pretest:once": "npm run build",
"test:once": "karma start karma.conf.js --single-run",
"lint": "tslint ./src/**/*.ts -t verbose"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/common": "~4.3.4",
"@angular/compiler": "~4.3.4",
"@angular/core": "~4.3.4",
"@angular/forms": "~4.3.4",
"@angular/http": "~4.3.4",
"@angular/platform-browser": "~4.3.4",
"@angular/platform-browser-dynamic": "~4.3.4",
"@angular/router": "~4.3.4",
"@angular/router-deprecated": "^2.0.0-rc.2",
"@types/firebase": "^3.2.1",
"angular-in-memory-web-api": "~0.3.0",
"angularfire2": "^5.0.0-rc.6",
"core-js": "^2.4.1",
"firebase": "4.8.0",
"materialize-css": "^0.100.2",
"ng2-bootstrap": "^1.6.3",
"react-route-config": "^2.0.1",
"react-router": "^4.2.0",
"rxjs": "5.0.1",
"systemjs": "0.19.40",
"zone.js": "^0.8.4"
},
"devDependencies": {
"concurrently": "^3.2.0",
"lite-server": "^2.2.2",
"typescript": "~2.1.0",
"canonical-path": "0.0.2",
"tslint": "^3.15.1",
"lodash": "^4.16.4",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"@types/node": "^6.0.46",
"@types/jasmine": "2.5.36"
},
"repository": {},
"main": "karma-test-shim.js"
}
请帮助我,我缺少什么
答案 0 :(得分:0)
为了连接你的firebase数据库,要对用户进行身份验证......你应该使用angularFire2。
在您的模块中,如果您想从firebase db获取数据:
import { AngularFirestore } from 'angularfire2/firestore';
如果您想验证用户使用:
import { AngularFireAuth } from 'angularfire2/auth';
我知道如何帮助你,否则你可能会更明确地解释你想做什么,或者在stackblitz / plunkr中复制你的问题?