Skip to content

"Workspace needs to be loaded before it is used." when trying to generate a new Service. #10757

Closed
@danbenge

Description

@danbenge

Versions

6.0.0

Repro steps

  • Open Visual Studio Code to your root Angular project folder.
  • Type in ng g component mynewcomponent

Observed behavior

Returns 

Workspace needs to be loaded before it is used.
Error: Workspace needs to be loaded before it is used.
    at Workspace._assertLoaded (D:\learn\Angular\my-first-app\node_modules\@angular-devkit\core\src\workspace\workspace.js:59:19)
    at Workspace.getProjectByPath (D:\learn\Angular\my-first-app\node_modules\@angular-devkit\core\src\workspace\workspace.js:103:14)
    at Object.getDefaultSchematicCollection (D:\learn\Angular\my-first-app\node_modules\@angular\cli\utilities\config.js:194:35)
    at GenerateCommand.parseSchematicInfo (D:\learn\Angular\my-first-app\node_modules\@angular\cli\commands\generate.js:71:39)
    at GenerateCommand.<anonymous> (D:\learn\Angular\my-first-app\node_modules\@angular\cli\commands\generate.js:36:58)
    at Generator.next (<anonymous>)
    at D:\learn\Angular\my-first-app\node_modules\@angular\cli\commands\generate.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (D:\learn\Angular\my-first-app\node_modules\@angular\cli\commands\generate.js:3:12)
    at GenerateCommand.initialize (D:\learn\Angular\my-first-app\node_modules\@angular\cli\commands\generate.js:30:16)

Desired behavior

Should create a new component.

Created the project using Angular CLI. Tried other projects and getting the same result.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions