【问题标题】:ERROR in node_modules after updating the npm?更新 npm 后 node_modules 中的错误?
【发布时间】:2021-02-20 13:48:57
【问题描述】:

这是我更新 npm 后遇到的错误,由于 [WDS] Disconnected 错误! Mozilla Firefox 控制台中的错误。这是有经验的开发者来解决的错误。


5 import firebase from 'firebase/app';
         ~~~~~~~~

  node_modules/firebase/index.d.ts:9710:1
    9710 export = firebase;
         ~~~~~~~~~~~~~~~~~~
    This module is declared with using 'export =', and can only be used with a default import when using the
'allowSyntheticDefaultImports' flag.
node_modules/@angular/fire/firestore/collection-group/collection-group.d.ts:2:8 - error TS1259: Module '"D:/apps/angularfs3/node_modules/firebase/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag

2 import firebase from 'firebase/app';
         ~~~~~~~~

  node_modules/firebase/index.d.ts:9710:1
    9710 export = firebase;
         ~~~~~~~~~~~~~~~~~~
    This module is declared with using 'export =', and can only be used with a default import when using the
'allowSyntheticDefaultImports' flag.
node_modules/@angular/fire/firestore/firestore.d.ts:9:8 - error TS1259: Module '"D:/apps/angularfs3/node_modules/firebase/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag

9 import firebase from 'firebase/app';
         ~~~~~~~~

  node_modules/firebase/index.d.ts:9710:1
    9710 export = firebase;
         ~~~~~~~~~~~~~~~~~~
    This module is declared with using 'export =', and can only be used with a default import when using the
'allowSyntheticDefaultImports' flag.
node_modules/@angular/fire/auth/auth.d.ts:4:8 - error TS1259: Module '"D:/apps/angularfs3/node_modules/firebase/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag

4 import firebase from 'firebase/app';
         ~~~~~~~~

  node_modules/firebase/index.d.ts:9710:1
    9710 export = firebase;
         ~~~~~~~~~~~~~~~~~~
    This module is declared with using 'export =', and can only be used with a default import when using the
'allowSyntheticDefaultImports' flag.
node_modules/@angular/fire/auth/auth.d.ts:12:14 - error TS2411: Property 'authState' of type 'Observable<any>' is not assignable to string index type 'Promise<any> & ((...args: unknown[]) => Promise<any>) & ((...args:
unknown[]) => any)'.

12     readonly authState: Observable<firebase.User | null>;
                ~~~~~~~~~
node_modules/@angular/fire/auth/auth.d.ts:16:14 - error TS2411: Property 'idToken' of type 'Observable<string>' is not assignable to string index type 'Promise<any> & ((...args: unknown[]) => Promise<any>) & ((...args: unknown[]) => any)'.

16     readonly idToken: Observable<string | null>;
                ~~~~~~~
node_modules/@angular/fire/auth/auth.d.ts:20:14 - error TS2411: Property 'user' of type 'Observable<any>' is
not assignable to string index type 'Promise<any> & ((...args: unknown[]) => Promise<any>) & ((...args: unknown[]) => any)'.

【问题讨论】:

  • 尝试删除 node_modules 文件夹并再次运行 npm i

标签: javascript angular firebase module


【解决方案1】:

您需要在tsconfig.jsoncompilerOptions 部分)中添加"allowSyntheticDefaultImports": true

【讨论】:

  • 谢谢你,@Francesco!这就是我的 Angular 升级所需要的
  • 谢谢@Francesco Colamonici
猜你喜欢
  • 2018-03-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-09
  • 1970-01-01
  • 2018-08-07
  • 2016-06-02
  • 1970-01-01
相关资源
最近更新 更多