Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.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
Android 使用npm cmd run的firebase云函数_Android_Node.js_Firebase - Fatal编程技术网

Android 使用npm cmd run的firebase云函数

Android 使用npm cmd run的firebase云函数,android,node.js,firebase,Android,Node.js,Firebase,我有一个firebase项目,它是完全设置,实时数据库设置和正常工作。如果实时数据库发生更改,我想在windows中执行cmd命令。为此,我使用了npm模块“npm cmd run”,我使用了firebase的云函数来实现这一点。 如果我在本地服务器上运行node.js文件,npm cmd run可以正常工作。但是当上传时,它不工作 下面是代码 提前谢谢 'use strict'; const functions = require('firebase-functions'); const

我有一个firebase项目,它是完全设置,实时数据库设置和正常工作。如果实时数据库发生更改,我想在windows中执行cmd命令。为此,我使用了npm模块“npm cmd run”,我使用了firebase的云函数来实现这一点。 如果我在本地服务器上运行node.js文件,npm cmd run可以正常工作。但是当上传时,它不工作 下面是代码 提前谢谢

'use strict';


const functions = require('firebase-functions');
const nrc=require('node-run-cmd');


const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.run = functions.database.ref('values/volume')

    .onWrite(event => {

      const original = event.data.val();
      console.log('executing', event.params.pushId, original);

      var commands = 'nircmd mutesysvolume 1';
      //the above cmd changes volume of windows


     nrc.run(commands);//run cmd command

    event.data.ref.parent.child('commands').set(commands);
      //write command into db for reference

    });