ng add @angular/fire 错误无法在非交互模式下运行登录

2024-04-21

当我跑步时:

ng add @angular/fire

我收到此错误:

$ ng add @angular/fire
Skipping installation: Package already installed
UPDATE package.json (1542 bytes)
- Installing packages (npm)...
✔ Packages installed successfully.
Cannot run login in non-interactive mode. See login:ci to generate a token for use in non-interactive environments.

我在 Windows 10 Pro Git Bash 上运行它。

此故障会导致其他错误,例如ng deploy失败是因为ng add @angular/fire更新失败angular.json与部署目标。有什么想法吗?非常感谢

运行于Node v14.17.1 and @angular/cli v11.2.14


好的,这是 Windows 问题。

代替:

ng add @angular/fire

Run:

winpty node_modules/.bin/ng.cmd add @angular/fire

如果失败则尝试:

npx firebase login --interactive // firebase should have been installed locally when the previous command failed
winpty node_modules/.bin/ng.cmd add @angular/fire

另外,代替:

ng deploy

Run:

winpty node_modules/.bin/ng.cmd deploy

最后,您可能希望将 package.json 部署脚本更新为如下所示:

"scripts": {
  ...
  "deploy": "ng deploy",
  "deploy:win": "winpty node_modules/.bin/ng.cmd deploy"
},

体面的操作系统用户可以部署npm run deployWindows 用户可以使用npm run deploy:win

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ng add @angular/fire 错误无法在非交互模式下运行登录 的相关文章

随机推荐