Firestore问题,如何修复child_process找不到问题

时间:2019-01-30 12:27:56

标签: javascript angular google-cloud-firestore

我试图利用admin.firestore()属性,但是当我运行该函数时出现此错误

core.js:1449 ERROR Error: Uncaught (in promise): Error: Cannot find module 
"child_process"
Error: Cannot find module "child_process"
at webpackMissingModule (googleauth.js:63)
at Object.<anonymous> (googleauth.js:63)
at Object.<anonymous> (vendor.js:297903)
at __webpack_require__ (bootstrap 766fd36b656e2ec12f90:54)
at Object.<anonymous> (index.js:18)
at __webpack_require__ (bootstrap 766fd36b656e2ec12f90:54)
at Object.<anonymous> (grpc.js:44)
at Object.<anonymous> (vendor.js:188367)
at __webpack_require__ (bootstrap 766fd36b656e2ec12f90:54)
at Object.<anonymous> (index.js:33)
at c (polyfills.js:3)
at c (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.js:4751)
at t.invokeTask (polyfills.js:3)
at r.runTask (polyfills.js:3)
at o (polyfills.js:3)
at e.invokeTask [as invoke] (polyfills.js:3)
at p (polyfills.js:2)

这是用于接收服务帐户的Admin.js(我正在隐藏服务器的任何数据)

const admin = require('firebase-admin');
const serviceAccount = require('AdminService/Admin.json');
admin.initializeApp({
    credential: admin.credential.cert(serviceAccount),
    databaseURL: 'https://<>.firebaseio.com'
});

Admin.json(请注意,我没有从firebase使用任何形式的增补,而是直接从集合中进行)

{
  "type": "service_account",
  "project_id": "",
  "private_key_id": "",
  "private_key": "",
  "client_email": "",
  "client_id": "",
  "auth_uri": "",
  "token_uri": "",
  "auth_provider_x509_cert_url": "",
  "client_x509_cert_url": ""
}

在我正在调用该函数的ts文件中:

import * as admin from 'firebase-admin';

  constructor() {
      admin.initializeApp();
  }

  removerAll() {
    var firestore = admin.firestore(); 
    var query = firestore.collection('produtosPedidos').where('pedido','==',this.pProdutos);
    query.get().then(function(querySnapshot) {
      querySnapshot.forEach(function(doc) {
        doc.ref.delete();
      });
    });
  }

我该如何解决?

0 个答案:

没有答案