Reactjs 反应+;Typescript中的Firebase云函数无法部署
我是我的项目,我想使用Reactjs 反应+;Typescript中的Firebase云函数无法部署,reactjs,typescript,firebase,google-cloud-functions,Reactjs,Typescript,Firebase,Google Cloud Functions,我是我的项目,我想使用 Firebase托管上托管的Typescript中的React应用程序 火库 Typescript中的Firebase函数 我在部署时遇到一个错误。很容易复制(现在跳过firestore和firebase主机初始化) 函数/src/index.ts是 import*作为“firebase函数”中的函数; //开始编写Firebase函数 // https://firebase.google.com/docs/functions/typescript export co
- Firebase托管上托管的Typescript中的React应用程序
- 火库
- Typescript中的Firebase函数
import*作为“firebase函数”中的函数;
//开始编写Firebase函数
// https://firebase.google.com/docs/functions/typescript
export const helloWorld=functions.https.onRequest((请求,响应)=>{
functions.logger.info(“Hello logs!”,{structuredData:true});
回复。发送(“来自Firebase的你好!”);
});
然后部署失败
firebase deploy
=== Deploying to 'myproject'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint /Users/username/sample-app/functions
> tslint --project tsconfig.json
Running command: npm --prefix "$RESOURCE_DIR" run build
> functions@ build /Users/username/sample-app/functions
> tsc
../node_modules/@types/testing-library__react/index.d.ts:13:49 - error TS7016: Could not find a declaration file for module '@testing-library/dom'. '/Users/username/sample-app/node_modules/@testing-library/dom/dist/index.js' implicitly has an 'any' type.
Try `npm install @types/testing-library__dom` if it exists or add a new declaration (.d.ts) file containing `declare module '@testing-library/dom';`
13 import { queries, Queries, BoundFunction } from '@testing-library/dom';
~~~~~~~~~~~~~~~~~~~~~~
../node_modules/@types/testing-library__react/index.d.ts:16:15 - error TS7016: Could not find a declaration file for module '@testing-library/dom'. '/Users/username/sample-app/node_modules/@testing-library/dom/dist/index.js' implicitly has an 'any' type.
Try `npm install @types/testing-library__dom` if it exists or add a new declaration (.d.ts) file containing `declare module '@testing-library/dom';`
16 export * from '@testing-library/dom';
~~~~~~~~~~~~~~~~~~~~~~
Found 2 errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ build: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions@ build 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! /Users/username/.npm/_logs/2020-08-04T06_14_06_195Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code2
即使在我这么做之后
npm安装@types/testing-library\uuu dom
在root和functions/中,部署失败
并且根目录
ls
README.md firebase.json functions node_modules package.json public src tsconfig.json yarn.lock
欢迎任何意见。如果这个解决方案适合您,您能试试吗 将此行添加到functions文件夹中的tsconfig:
{
“编译器选项”:{
...
“类型根”:[
“节点\模块/@类型”,
],
...
}
这是为我工作的“编译器选项”块的一部分
你能将问题的复制推到git存储库中,以便我们进行调试吗?非常感谢,你节省了我的时间。只是出于好奇,你是如何找到它的?不客气!当类型存在且未被检测到时,通常是
tsconfig.json
中的问题。在我看来,正确设置有点困难。实际上我不记得我是否在谷歌上搜索过,或者我是否在本页右侧的相关问题中看到了链接。谢谢你!我一周前才开始写打字稿,现在我能更好地理解了,谢谢你!
ls
README.md firebase.json functions node_modules package.json public src tsconfig.json yarn.lock