gpt4 book ai didi

Firebase Functions Deploy 在错误的目录中查找 Node_Modules

转载 作者:行者123 更新时间:2023-12-02 22:11:27 24 4
gpt4 key购买 nike

当尝试部署我的 Firebase 函数时,我在父目录的 node_modules 中收到错误,即使我的 Firebase 函数目录有自己的函数。我非常确定当我运行“firebase部署--only函数”时我在我的函数目录中知道为什么它查看父目录???

错误:

    > tsc -p tsconfig.json

../node_modules/@types/highcharts/index.d.ts(53,33): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(186,23): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(187,27): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(188,26): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(189,27): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(623,33): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(635,32): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1360,38): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1374,39): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1385,43): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1404,43): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1431,28): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1437,29): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1463,25): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1468,28): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1478,22): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1488,24): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1495,24): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1897,29): error TS2304: Cannot find name 'HTMLElement'.
../node_modules/@types/highcharts/index.d.ts(2174,26): error TS2304: Cannot find name 'HTMLElement'.
../node_modules/@types/highcharts/index.d.ts(3383,41): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(3394,38): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(3409,30): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(3442,33): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(3451,26): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(3458,27): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(3556,23): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(3564,26): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(3572,27): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(3580,24): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(3588,24): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(3596,26): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(3604,24): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(3611,33): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(6216,20): error TS2304: Cannot find name 'HTMLElement'.
../node_modules/@types/highcharts/index.d.ts(6438,33): error TS2304: Cannot find name 'HTMLElement'.
../node_modules/@types/highcharts/index.d.ts(6448,33): error TS2304: Cannot find name 'HTMLElement'.
../node_modules/@types/highcharts/index.d.ts(6642,26): error TS2304: Cannot find name 'HTMLElement'.
../node_modules/@types/highcharts/index.d.ts(6659,34): error TS2304: Cannot find name 'HTMLElement'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ build: `tsc -p tsconfig.json`
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.

目录结构: enter image description here

我的Package.json:

    {
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "node_modules/.bin/tsc -p tsconfig.json",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase experimental:functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "~5.10.0",
"firebase-functions": "^0.9.0"
},
"devDependencies": {
"tslint": "^5.8.0",
"typescript": "^2.5.3"
},
"private": true
}

最佳答案

有同样的问题,这为我解决了 Firebase-Admin package Typescript error in Cloud Functions Firestore : @types/googlemaps 。只需将其添加到函数文件夹中的 tsconfig.json 中即可:

"files": [
"node_modules/typescript/lib/lib.es6.d.ts"
],
"exclude": [
"node_modules"
]

关于Firebase Functions Deploy 在错误的目录中查找 Node_Modules,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49558076/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com