Cloud Functions Firebase CLI预部署错误(打字稿) [英] Cloud Functions Firebase CLI predeploy error (typescript)
问题描述
我正在尝试使用打字稿的Cloud Functions.
成功安装后,添加触发器并测试部署.
I´m trying Cloud Functions with typescript.
After successfully installed, added a trigger and tested deploy.
index.ts
import * as functions from 'firebase-functions';
export const createAccount = functions.auth.user().onCreate(event => {
const user = event.data;
console.log('user displayname', user.displayName);
return;
});
命令
firebase deploy --only functions
=== Deploying to 'project'...
i deploying functions
i functions: running predeploy script.
> functions@ build D:\vmbox\project\firebase\functions
> tslint -p tslint.json && ./node_modules/.bin/tsc
错误
'.' is not recognized as an internal or external command,
operable program or batch file.
环境
firebase cli v3.16.0
节点v6.11.2
npm v4.2.0
操作系统:Windows 10
终端:powershell
Environment
firebase cli v3.16.0
node v6.11.2
npm v4.2.0
OS: Windows 10
terminal: powershell
///
我使用Javascript选项重新启动了功能,并且在部署时也出现了错误.
我想这可能与cli为打字稿进行的设置有关.
不得不删除添加到"firebase.json"中的功能"选项.
I re-initiated functions with Javascript option, and also got errors when deploying.
I guess it may be related to a setup made by the cli for typescript.
Had to delete the "functions" option added to "firebase.json".
选项:
"functions": {
"predeploy": "npm --prefix functions run build"
}
推荐答案
只需在package.json
此内部替换
"build": "./node_modules/.bin/tslint.cmd -p tslint.json && ./node_modules/.bin/tsc.cmd"
对此
"build": ".\\node_modules\\.bin\\tslint.cmd -p tslint.json && .\\node_modules\\.bin\\tsc.cmd"
它将在Windows上运行.
and it will work on windows.
这篇关于Cloud Functions Firebase CLI预部署错误(打字稿)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!