Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Functions Deploy looking in wrong directory for Node_Modules

When attempting to deploy my firebase functions, I am getting an error the the parent directory's node_modules, eventhough my firebase functions directory has its own functions. I am VERY sure I am in my functions directory when i run "firebase deploy --only functions" Any idea why It is look at the parents directory???

The error:

    > 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.

the directory structure: enter image description here

My 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
}
like image 728
Kevin192291 Avatar asked Mar 29 '18 14:03

Kevin192291


1 Answers

had the same problem and this fix it for me Firebase-Admin package Typescript error in Cloud Functions Firestore : @types/googlemaps. Just add this to your tsconfig.json on functions folder:

"files": [
    "node_modules/typescript/lib/lib.es6.d.ts"
],
"exclude": [
    "node_modules"
]
like image 81
Alvaro Flores Avatar answered Nov 01 '22 07:11

Alvaro Flores