我正试图在另一个系统上设置我的Firebase TypeScript应用程序。当我执行firebase login
时,它抛出以下异常:
[debug] [2020-07-10T12:35:28.031Z] ----------------------------------------------------------------------
[debug] [2020-07-10T12:35:28.034Z] Command: C:Program Filesnodejsnode.exe C:UsersgpAppDataRoamingnpmnode_modulesfirebase-toolslibbinfirebase.js login
[debug] [2020-07-10T12:35:28.034Z] CLI Version: 8.5.0
[debug] [2020-07-10T12:35:28.034Z] Platform: win32
[debug] [2020-07-10T12:35:28.035Z] Node Version: v12.18.2
[debug] [2020-07-10T12:35:28.036Z] Time: Fri Jul 10 2020 18:05:28 GMT+0530 (India Standard Time)
[debug] [2020-07-10T12:35:28.036Z] ----------------------------------------------------------------------
[debug] [2020-07-10T12:35:28.037Z]
[info] i Firebase optionally collects CLI usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you.
[info] i To change your data collection preference at any time, run `firebase logout` and log in again.
[info]
[info] Visit this URL on this device to log in:
[info] https://accounts.google.com/o/oauth2/auth?client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplatformprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=3839&redirect_uri=http%3A%2F%2Flocalhost%3A
[info]
[info] Waiting for authentication...
[debug] [2020-07-10T12:57:25.170Z] Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
[error]
[error] Error: An unexpected error has occurred.
在新系统上,我使用以下软件:
- 节点v12.18.2
- npm版本6.14.5
在旧系统上,我使用以下软件:
- 节点v10.16.3
- npm v6.12.0
我也尝试过以下方法:
- 执行
npm install -g firebase-tools@latest
- 在以管理员身份运行的单独cmd中执行所有步骤
在我以前的工作区里一切都很顺利。
通过在我的环境变量中添加'C:\Windows\System32'修复了这个问题。