使用命令firebase deploy--only functions在firebase上部署函数时出错

uqjltbpv  于 2021-06-27  发布在  Java
关注(0)|答案(0)|浏览(225)

我正试图使用firebase deploy命令在firebase上部署一个函数——只部署函数,但错误日志如下
请有人帮我一下
我的功能如下

npm@6.14.10
           node@v12.0.0
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();

exports.sendNotification = functions.database.ref
('/Notifications/{user_id}/{notification_id}').onWrite((change, context) => 
{

    const user_id = context.params.user_id;
    const notification_id = context.params.notification_id;

    console.log('We have a notification to send to :',user_id);

    if(!change.after.val()){

       return console.log('A notification has been deleted from the database ',notification_id);
       }

    const fromUser = admin.database().ref(`/Notifications/${user_id}/${notification_id}`).once('value');

    return fromUser.then(fromUserResult =>{

        const from_user_id = fromUserResult.val().From;

        console.log('you have new notification from ',from_user_id);

    const userQuery = admin.database().ref(`users/${from_user_id}/username`).once('value');
    const deviceToken = admin.database().ref(`/users/${user_id}/device_token`).once('value');  
    const state_app = admin.database().ref(`/users/${user_id}/state_app`).once('value');   
    //const language_app = admin.database().ref(`/users/${user_id}/language_app`).once('value');   
    const notification_state = admin.database().ref(`/notifications_state/${user_id}/${from_user_id}/state`).once('value');   

            return Promise.all([userQuery,deviceToken,state_app,notification_state]).then(result =>{

                const username = result[0].val();
                const token_id = result[1].val();
                const state_app = result[2].val();
                //const language_app = result[3].val();
                const notification_state = result[3].val();

                    if(state_app!="start"){

                        if(notification_state=="message"){

                                        const payload = {
                                                notification:{
                                                    title : "New message",
                                                    body  : `${username} sent you a message.`,
                                                    icon  : "default",
                                                    sound : "default",
                                                    click_action: "com.randomchat.peku_TARGET_NOTIFICATION_messages"

                                                    },data:{
                                                    userIDvisited : from_user_id }
                                                };

                                        return admin.messaging().sendToDevice(token_id,payload).then(response => {
                                            console.log('this was the notification Feature ');

                                        });
                        }
                        if(notification_state=="video_call"){

                            const payload = {
                                    notification:{
                                        title : "Video Call",
                                        body  : `${username} calling you.`,
                                        icon  : "default",
                                        sound : "default",
                                        click_action: "com.randomchat.peku_TARGET_NOTIFICATION_video_call"

                                        },data:{
                                            userIDvisited : from_user_id }
                                    };

                            return admin.messaging().sendToDevice(token_id,payload).then(response => {
                                console.log('this was the notification Feature video call');

                            });
                        }   
                    }

            });

    });                   
});

**

下面的错误日志

**

functions@lint c:\function\u pekuu\functions eslint。
openssl配置失败:error:02001003:系统library:fopen:无此过程
c:\函数\u pekuu\functions\index.js
8:1错误函数和之间的意外换行(函数调用的)没有意外的多行
36:20警告避免嵌套承诺/不嵌套
36:98警告预期返回箭头函数末尾的值一致返回
44:21 error each then()应返回值或抛出promise/始终返回
44:33预期错误'!='却看到了“!=”EQEQ公司
46:46错误应为“==”,而不是看到“==”eqeq
60:48警告避免嵌套承诺/不嵌套
60:102 error each then()应返回值或抛出promise/始终返回
65:46错误应为“==”,而不是看到“==”eqeq
79:36警告避免嵌套承诺/不嵌套
79:90 error each then()应返回值或抛出promise/始终返回

标题##?11个问题(7个错误,4个警告)

npm错误!代码失效循环
npm错误!错误1
npm错误!函数@lint: eslint . npm错误!退出状态1
npm错误!
npm错误!在函数@lint脚本中失败。
npm错误!这可能不是npm的问题。上面可能有额外的日志输出。
npm错误!此运行的完整日志可在以下位置找到:
npm错误!c:\users\hp elitebook\appdata\roaming\npm-cache\U logs\2021-01-05t07
_45_22_925z-debug.log events.js:173抛出器;//未处理的“错误”事件^
错误:spawn npm--前缀“%resource\u dir%”在notfounderror处运行lint enoint(c:\users\hp elitebook\appdata\roaming\npm\node\u modules\firebase tools\node\u modules\cross env\node\u modules\cross spawn\lib\enoint.js:6:26)

at verifyENOENT (C:\Users\HP ELITEBOOK\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)

at ChildProcess.cp.emit (C:\Users\HP ELITEBOOK\AppData\Roaming\npm\node_modu

les\firebase tools\node\u modules\cross env\node\u modules\cross spawn\lib\enoint.js:27:25)

at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)

在以下位置发出“错误”事件:

at ChildProcess.cp.emit (C:\Users\HP ELITEBOOK\AppData\Roaming\npm\node_modu

les\firebase tools\node\u modules\cross env\node\u modules\cross spawn\lib\enoint.js:30:37)

at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)

错误:函数predeploy错误:命令以非零退出代码1终止

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题