私のIonic 3プロジェクトでコマンドfirebase deploy --only function
を実行すると、次のエラーが発生します。 この解決策 が機能しません。
Running command: npm --prefix "$RESOURCE_DIR" run build
> functions@ build /Users/myuser/Project/functions
> tsc
node_modules/firebase-functions/lib/function-configuration.d.ts:4:64 - error TS1005: ']' expected.
4 export declare const SUPPORTED_REGIONS: readonly ["us-central1", "us-east1", "us-east4", "europe-west1", "europe-west2", "asia-east2", "asia-northeast1"];
~
node_modules/firebase-functions/lib/function-configuration.d.ts:4:66 - error TS1134: Variable declaration expected.
4 export declare const SUPPORTED_REGIONS: readonly ["us-central1", "us-east1", "us-east4", "europe-west1", "europe-west2", "asia-east2", "asia-northeast1"];
~~~~~~~~~~
node_modules/firebase-functions/lib/function-configuration.d.ts:4:153 - error TS1005: ';' expected.
4 export declare const SUPPORTED_REGIONS: readonly ["us-central1", "us-east1", "us-east4", "europe-west1", "europe-west2", "asia-east2", "asia-northeast1"];
~
node_modules/firebase-functions/lib/function-configuration.d.ts:16:61 - error TS1005: ']' expected.
16 export declare const VALID_MEMORY_OPTIONS: readonly ["128MB", "256MB", "512MB", "1GB", "2GB"];
~
node_modules/firebase-functions/lib/function-configuration.d.ts:16:63 - error TS1134: Variable declaration expected.
16 export declare const VALID_MEMORY_OPTIONS: readonly ["128MB", "256MB", "512MB", "1GB", "2GB"];
~~~~~~~
node_modules/firebase-functions/lib/function-configuration.d.ts:16:93 - error TS1005: ';' expected.
16 export declare const VALID_MEMORY_OPTIONS: readonly ["128MB", "256MB", "512MB", "1GB", "2GB"];
~
ファイルnode_modules/firebase-functions/lib/function-configuration.d.tsを調べると、構文エラーが表示されています。
バージョンの詳細:
"angularfire2": "^5.2.1",
"firebase": "^6.3.1",
"firebase-admin": "^8.2.0",
"firebase-functions": "3.2.0",
"TypeScript": "^3.5.3"
私の場合、packege.jsonからスタブタイプを削除しただけで機能し始め、すべてが機能していなかったので、この古いたわごとは新しいバージョンのfirebaseと互換性がないため、これはあなたの依存関係にありますが、私は問題がここから発生していることを100%確信しています。
_"dependencies": {
"@types/firebase": "^3.2.1", <<====== this is shit man
"@types/fs-extra": "^8.0.1",
"@types/mongoose": "^5.5.43",
"@types/request": "^2.48.4",
"actions-on-google": "^2.12.0",
"bcrypt-inzi": "^1.0.7",
"body-parser": "^1.18.3",
"dialogflow-fulfillment": "^0.6.1",
"express": "^4.17.1",
"firebase-admin": "^8.6.0",
"firebase-functions": "^3.3.0",
"fs-extra": "^8.1.0",
"mongoose": "^5.8.9",
"request": "^2.88.0"
},
_
npm iを実行しているときにこの警告に気づきましたか
npm WARN deprecated @types/[email protected]: This is a stub types definition for Firebase API (https://www.firebase.com/docs/javascript/firebase). Firebase API provides its own type definitions, so you don't need @types/firebase installed!
firebase関数には独自のタイピングファイルがあるため、今はまったく必要ありません。