Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase错误:";分析触发器时出错:找不到模块'/clone.js'&引用;_Firebase_Google Cloud Storage_Google Cloud Functions_Clone_Firebase Storage - Fatal编程技术网

Firebase错误:";分析触发器时出错:找不到模块'/clone.js'&引用;

Firebase错误:";分析触发器时出错:找不到模块'/clone.js'&引用;,firebase,google-cloud-storage,google-cloud-functions,clone,firebase-storage,Firebase,Google Cloud Storage,Google Cloud Functions,Clone,Firebase Storage,当我运行firebase deploy--仅函数时,我会收到以下错误消息: Error parsing triggers: Cannot find module './clone.js' 这是我的代码,复制自: 这是不是clone.js这?我将常量移到函数中,错误消失了: const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp()

当我运行
firebase deploy--仅函数
时,我会收到以下错误消息:

Error parsing triggers: Cannot find module './clone.js'
这是我的代码,复制自:


这是不是
clone.js
这?

我将常量移到函数中,错误消失了:

const functions = require('firebase-functions');
const admin = require('firebase-admin');

admin.initializeApp();

exports.Storage = functions.firestore.document('Test_Value').onUpdate((change, context) => {

  const {Storage} = require('@google-cloud/storage');
  const storage = new Storage();
  const bucketName = 'myapp.appspot.com';
  const filename = './hola_mundo.wav';

  storage.bucket(bucketName).upload(filename, {
    gzip: true,
    metadata: {
      cacheControl: 'no-cache'
    }
  })
  .then(() => {
    console.log(`${filename} uploaded to ${bucketname}`);
  })
  .catch(err => {
    console.error(err);
  });

});
const functions = require('firebase-functions');
const admin = require('firebase-admin');

admin.initializeApp();

exports.Storage = functions.firestore.document('Test_Value').onUpdate((change, context) => {

  const {Storage} = require('@google-cloud/storage');
  const storage = new Storage();
  const bucketName = 'myapp.appspot.com';
  const filename = './hola_mundo.wav';

  storage.bucket(bucketName).upload(filename, {
    gzip: true,
    metadata: {
      cacheControl: 'no-cache'
    }
  })
  .then(() => {
    console.log(`${filename} uploaded to ${bucketname}`);
  })
  .catch(err => {
    console.error(err);
  });

});