异步/等待中对Google eslint错误的操作

时间:2019-04-02 18:26:17

标签: google-cloud-storage google-cloud-functions eslint actions-on-google

我已经将一些示例录音录制到Firebase云存储中,然后我尝试使用SSML将这些录音包括在google action语音中。 但是我面临的问题是,由于eslint错误,我无法将云功能部署到Firebase,该错误显示在异步 conv 对象旁边。 并显示解析错误:意外的令牌转化 我正在按照这篇https://medium.com/google-developers/using-cloud-storage-for-firebase-for-hosting-rich-media-in-your-actions-a838977eb758中等帖子进行实施,但无法正常工作。

以下是错误的完整说明:     部署功能     运行命令:npm --prefix“ $ RESOURCE_DIR”运行lint

> functions@ lint /home/nish/Documents/Projects/Voice/functions
> eslint .


/home/nish/Documents/Projects/Voice/functions/index.js
17:44  error  Parsing error: Unexpected token conv

✖ 1 problem (1 error, 0 warnings)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `eslint .`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely 
additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nish/.npm/_logs/2019-04-02T18_17_17_639Z- 
debug.log

Error: functions predeploy error: Command terminated with non-zero exit code1

这是代码

const functions = require("firebase-functions");
const admin = require("firebase-admin");
admin.initializeApp(functions.config().firebase);
const bucket = admin.storage().bucket();
const bucketAccessConfig = {
    action: "read",
    expires: Date.now() + 1000 * 60 * 60
};

app.intent("Default Welcome Intent", async conv => {
    // eslint-disable-line no-use-before-define
    let intentName = "Default_Welcome_Intent";
    Path = `${intentName}/${Math.floor(Math.random() * 4) + 1}.ogg`;
    const soundFileRef = bucket.file(Path);
    const [soundUrl] = await soundFileRef.getSignedUrl(bucketAccessConfig);
    // console.log(Path);
    // console.log(storage);
    conv.ask(`<speak><audio src=${soundUrl}/></speak>`);
});

0 个答案:

没有答案