4

I'm using Angular 15 and Node version 18.12.1.

I created a new application in Visual Studio Code but learned that Angular no longer provides the environment files that were for test and production purposes.

I want these environment files back so I followed the instructions from Angular's site.

https://angular.io/guide/build

From PowerShell I entered "ng generate environments" but I get the following error message:

"Error: A collection and schematic is required during execution"

I need help figuring out how to get this working.

I followed the directions on Angular's site and that didn't work.

I also tried updating my version of Node just to be sure it was up-to-date.

None of these resolved my issue to create the environment files.

AwryTech
  • 43
  • 3

1 Answers1

7

There was a Github issue for this: https://github.com/angular/angular-cli/issues/24381

Also check this related post: Angular 15 CLI does not create environments folder when creating an angular project via ng new

EDIT: Found another article about this, apparantly in Angular version 15.1 it should work again: https://dev.to/this-is-angular/angular-15-what-happened-to-environmentts-koh

So check your current version:

ng version

Do update (if it's 15.0.X):

ng update

Then this should work again:

ng generate environments
AskC
  • 96
  • 3
  • 1
    Thank you. That was the main issue. I needed up update my Angular version first. – AwryTech Feb 01 '23 at 02:04
  • The CLI does a pretty good job about telling you what to do next, but in the event that you get "We analyzed your package.json, there are some packages to update:", run the command in the "Command to update" column for the additional dependencies. – Alan D. Powell Jun 16 '23 at 21:24