Firebase云函数代码ELIFECYCLE错误



尝试通过调用firebase deploy来部署firebase init提供的云功能的初始代码时,出现以下错误:index.ts内部的源代码没有被修改,因为它是与项目的其余部分的情况。

Running command: npm --prefix "$RESOURCE_DIR" run build
> functions@ build /Users/eliasdolinsek/development/firebase-development/functions
> tsc
../../../node_modules/@types/fs-extra/index.d.ts:195:87 - error TS2694: Namespace '"fs"' has no exported member 'Dir'.
195 export function opendir(path: string, cb: (err: NodeJS.ErrnoException | null, dir: fs.Dir) => void): void;
                    ~~~
../../../node_modules/@types/fs-extra/index.d.ts:198:17 - error TS2694: Namespace '"fs"' has no exported member 'OpenDirOptions'.
198     options: fs.OpenDirOptions,
~~~~~~~~~~~~~~
../../../node_modules/@types/fs-extra/index.d.ts:199:53 - error TS2694: Namespace '"fs"' has no exported member 'Dir'.
199     cb: (err: NodeJS.ErrnoException | null, dir: fs.Dir) => void,
~~~
../../../node_modules/@types/fs-extra/index.d.ts:201:52 - error TS2694: Namespace '"fs"' has no exported member 'OpenDirOptions'.
201 export function opendir(path: string, options?: fs.OpenDirOptions): Promise<fs.Dir>;
~~~~~~~~~~~~~~
../../../node_modules/@types/fs-extra/index.d.ts:201:80 - error TS2694: Namespace '"fs"' has no exported member 'Dir'.
201 export function opendir(path: string, options?: fs.OpenDirOptions): Promise<fs.Dir>;
             ~~~

Found 5 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/eliasdolinsek/.npm/_logs/2021-01-26T13_18_50_649Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code2

typeRoots添加到功能文件夹中的tsconfig.json

{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017",
"typeRoots": [
"./functions/node_modules/@types"
],
},
"compileOnSave": true,
"include": [
"src"
],
}

查看这个Github问题

最新更新