user3334871
user3334871

Reputation: 1361

Adding Angular CLI support to old Angular 2 app

I have a project that was created a long time back without using Angular CLI tools. Recently, I've been trying to look at improving load performance within my app, and I wanted to see if I can use the optimization tools under CLI, so I installed it with npm. When trying to run the command "ng build" I get the following error: The build command requires to be run in an Angular project, but a project definition could not be found.

Does Angular CLI require the app to be created under the tool? I've been using package.json to define my angular app, but I see mentions of using angular.json for cli, do I need to modify the package.json file? Is there a way I can support the CLI module under my app?

Upvotes: 0

Views: 127

Answers (1)

Noremac
Noremac

Reputation: 594

The easiest method is to use Angular CLI to create a brand new application by running ng new your-app-name. Migrate your packages over to the newly generated package.json file. Delete the app module that was generated and use your existing app module.

Upvotes: 2

Related Questions