angular / angular/angularfire

File /src/environments/environment.ts does not exist on ng add with Angular 15

Abierto
#3,294 8 comentarios 16 reacciones 1 asignado Reclamado por @MarkTechson Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
7.8k
Forks
2.2k
Merge medio
22 h 28 min
PR fusionados (30 d)
6

Descripción

`/src/environments/environment.ts` is optional now with Angular 15. Angularfire's schematics should detect this to avoid an error.

### Version info

**Angular:** 15.0.1

**Firebase:** 9.14.0

**AngularFire:** 7.5.0

**Other (e.g. Ionic/Cordova, Node, browser, operating system):** Node 19.1.0, no browser, Ubuntu 22.10

### How to reproduce these conditions

**Failing test unit, Stackblitz demonstrating the problem**

Just run `ng new test123 && cd test123 && ng add @angular/fire`.

**Steps to set up and reproduce**

```
home@daniel-desktop3:/run/user/1000$ ng new test123
Node.js version v19.1.0 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
? Would you like to add Angular routing? No
? Which stylesheet format would you like to use? CSS
CREATE test123/README.md (1061 bytes)
CREATE test123/.editorconfig (274 bytes)
CREATE test123/.gitignore (548 bytes)
CREATE test123/angular.json (2705 bytes)
CREATE test123/package.json (1038 bytes)
CREATE test123/tsconfig.json (901 bytes)
CREATE test123/tsconfig.app.json (263 bytes)
CREATE test123/tsconfig.spec.json (273 bytes)
CREATE test123/.vscode/extensions.json (130 bytes)
CREATE test123/.vscode/launch.json (474 bytes)
CREATE test123/.vscode/tasks.json (938 bytes)
CREATE test123/src/favicon.ico (948 bytes)
CREATE test123/src/index.html (293 bytes)
CREATE test123/src/main.ts (214 bytes)
CREATE test123/src/styles.css (80 bytes)
CREATE test123/src/assets/.gitkeep (0 bytes)
CREATE test123/src/app/app.module.ts (314 bytes)
CREATE test123/src/app/app.component.css (0 bytes)
CREATE test123/src/app/app.component.html (23083 bytes)
CREATE test123/src/app/app.component.spec.ts (959 bytes)
CREATE test123/src/app/app.component.ts (211 bytes)
✔ Packages installed successfully.
Successfully initialized git.
home@daniel-desktop3:/run/user/1000$ cd test123
home@daniel-desktop3:/run/user/1000/test123$ ng add @angular/fire
Node.js version v19.1.0 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
? Would you like to share pseudonymous usage data about this project with the Angular Team
at Google under Google's Privacy Policy at https://policies.google.com/privacy. For more
details and how to change this setting, see https://angular.io/analytics. No
Global setting: enabled
Local setting: disabled
Effective status: disabled
ℹ Using package manager: npm
✔ Found compatible package version: @angular/fire@7.5.0.
✔ Package information loaded.

The package @angular/fire@7.5.0 will be installed and executed.
Would you like to proceed? Yes
✔ Packages successfully installed.
UPDATE package.json (1068 bytes)
✔ Packages installed successfully.
? What features would you like to setup? Authentication, Firestore
Using firebase-tools version 11.16.1
? Which Firebase account would you like to use? test@example.com
✔ Preparing the list of your Firebase projects
? Please select a project: project12345
✔ Preparing the list of your Firebase WEB apps
? Please select an app: project-lab12345
✔ Downloading configuration data of your Firebase WEB app
File /src/environments/environment.ts does not exist
```

**Sample data and security rules**

The Firebase project online is a new and empty project.

### Debug output

** Errors in the JavaScript console **

This is not a runtime problem.

** Output from `firebase.database().enableLogging(true);` **

This is not a runtime problem.

** Screenshots **

Console output pasted above.

### Expected behavior

It should succeed and I should not see any red lines in the terminal.

### Actual behavior

ng add fails at a red line `File /src/environments/environment.ts does not exist` then exits without completing. See the output above.

Now I have to set up angularfire manually. I could have created environment.ts but it would still feel equally manual.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.