尝试部署我的firebase函数时,我收到了父目录的node_modules的错误,尽管我的firebase函数目录有自己的函数。当我运行“firebase deploy --only functions”时,我非常确定我在我的函数目录中。任何想法为什么它看看父目录???
错误:
> 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.
我的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
}
答案 0 :(得分:17)
遇到了同样的问题,并为我Firebase-Admin package Typescript error in Cloud Functions Firestore : @types/googlemaps解决了这个问题。
只需将其添加到函数文件夹中的"files": [
"node_modules/typescript/lib/lib.es6.d.ts"
],
"exclude": [
"node_modules"
]
:
UIAlertController
答案 1 :(得分:0)
我的np.nan
已经具有上述tsconfig.json
和files
。我只需要在functions目录中运行exclude
即可解决该错误。