0

I am completely new in angular and I've created a project using SpringBoot 2.0.5.RELEASE, Angular 5 and spring data to build an end to end single page java web application. I use spring boot 1.5 to expose REST APIs and angular5 with routing to build the client that will consume the APIs exposed by the server

I just set up a project to work with SpringBoot 2.0.5.RELEASE. When I do :

$ ng -v
    Your global Angular CLI version (6.2.4) is greater than your local
    version (6.2.3). The local Angular CLI version is used.

    To disable this warning use "ng config -g cli.warnings.versionMismatch false".

         _                      _                 ____ _     ___
        / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
       / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
      / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
     /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                    |___/


    Angular CLI: 6.2.3
    Node: 10.11.0
    OS: darwin x64
    Angular: 5.1.3
    ... animations, common, compiler, compiler-cli, core, forms
    ... http, language-service, platform-browser
    ... platform-browser-dynamic, router

    Package                      Version
    ------------------------------------------------------
    @angular-devkit/architect    0.8.3
    @angular-devkit/core         0.8.3
    @angular-devkit/schematics   0.8.3
    @angular/cli                 6.2.3
    @schematics/angular          0.8.3
    @schematics/update           0.8.3
    rxjs                         5.5.6
    typescript                   2.4.2

Everything seems to be fine.

Then I do

$ npm install
audited 11048 packages in 3.985s
found 0 vulnerabilities

and everything seems to be also fine.

But when I do

$ ng build
Your global Angular CLI version (6.2.4) is greater than your local
version (6.2.3). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.
    at WorkspaceLoader._getProjectWorkspaceFilePath (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/models/workspace-loader.js:44:19)
    at WorkspaceLoader.loadWorkspace (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/models/workspace-loader.js:31:21)
    at BuildCommand._loadWorkspaceAndArchitect (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/models/architect-command.js:201:32)
    at BuildCommand.<anonymous> (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/models/architect-command.js:53:25)
    at Generator.next (<anonymous>)
    at /Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/models/architect-command.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/models/architect-command.js:3:12)
    at BuildCommand.initialize (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/models/architect-command.js:52:16)
    at Object.<anonymous> (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/models/command-runner.js:127:23)

I tried to update the project using:

npm install -g @angular-devkit/core
npm install -g @angular/cli
npm install @angular/cli

But when I run

ng update @angular/cli
Workspace needs to be loaded before it is used.
Error: Workspace needs to be loaded before it is used.
    at Workspace._assertLoaded (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular-devkit/core/src/workspace/workspace.js:68:19)
    at Workspace.getProjectByPath (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular-devkit/core/src/workspace/workspace.js:116:14)
    at getProjectByCwd (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/utilities/config.js:103:26)
    at Object.getPackageManager (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/utilities/config.js:115:25)
    at UpdateCommand.getWorkflow (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/models/schematic-command.js:105:38)
    at UpdateCommand._getWorkflow (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/models/schematic-command.js:111:35)
    at UpdateCommand.runSchematic (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/models/schematic-command.js:121:31)
    at UpdateCommand.<anonymous> (/Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/commands/update-impl.js:76:25)
    at Generator.next (<anonymous>)
    at /Users/nunet/Development/J2EE/eclipseWSJ2EE/portal-app/node_modules/@angular/cli/commands/update-impl.js:14:71
Nuñito Calzada
  • 4,394
  • 47
  • 174
  • 301
  • It looks like your project was generated with Angular CLI 6.2.3, but you have 6.2.4 running globally. Additionally, you don't have an `angular.json` file within the folder you're currently running the `ng build` command within. Make sure that you're building within the correct folder and that you didn't delete it somehow. Perhaps you have to show us your project structure. – g00glen00b Oct 04 '18 at 13:31
  • could be because I took a sample project and install the last version of Angular CLI – Nuñito Calzada Oct 04 '18 at 13:34
  • I take it from here where I don't see the file angular.json, either: https://github.com/only2dhir/spring-boot-angular5/tree/master/portal-app – Nuñito Calzada Oct 04 '18 at 13:40
  • Well, that project was generated with Angular CLI 1.6.3 as mentioned by the `README.md`. So yeah, without migrating it, this setup won't work. The [Angular Update Guide](https://update.angular.io/) might help, but right now it doesn't look like you properly migrated your project to work with Angular CLI 6.x.x. – g00glen00b Oct 04 '18 at 13:55

1 Answers1

0

You need to convert .angular-cli.json to angular.json. Reference this for details.

The Gilbert Arenas Dagger
  • 12,071
  • 13
  • 66
  • 80