Error: Local workspace file ('angular.json') was not found.

I have travis-ciintegrated GitHub with my account ( https://github.com/pradeep0601/Angular5-Router-App ).

When I upgraded the @angular/clicli version from 1.7.4 to 6.0.0-rc.3, the assembly started to fail with an error:

Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.
    at WorkspaceLoader._getProjectWorkspaceFilePath (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/workspace-loader.js:37:19)
    at WorkspaceLoader.loadWorkspace (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/workspace-loader.js:24:21)
    at TestCommand._loadWorkspaceAndArchitect (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:177:32)
    at TestCommand.<anonymous> (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:45:25)
    at Generator.next (<anonymous>)
    at /home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:3:12)
    at TestCommand.initialize (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:44:16)
    at /home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/command-runner.js:100:23

A snippet of package.json for a better understanding of the working environment:

    "@angular/cli": "6.0.0-rc.3",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
+182
source share
22 answers

I just had the same problem.

This is due to the release of v6.0.0-rc.2, https://github.com/angular/angular-cli/releases :

. angular.json ( .angular.json). ng update CLI 1.7 .

:

ng update @angular/cli --migrate-only --from=1.7.4

.angular-cli.json angular.json.

, 1.7.4, v6 :

npm install --save-dev @angular/cli@v6.0.0-rc.4

:

ng update @angular/cli --migrate-only --from=1.7.4
+302

. , ng serve , Angular . , ( ) .

+70

, --migrate-only --migrate-only.

Angular CLI , :

ng update @angular/cli
            Updating karma configuration
            Updating configuration
            Removing old config file (.angular-cli.json)
            Writing config file (angular.json)
            Some configuration options have been changed, please make sure to update any npm scripts which you may have modified.
DELETE .angular-cli.json
CREATE angular.json (3684 bytes)
UPDATE karma.conf.js (1040 bytes)
UPDATE src/tsconfig.spec.json (322 bytes)
UPDATE package.json (1340 bytes)
UPDATE tslint.json (3140 bytes)
+35

Angular cli Angular CLI global:

Angular cli , "@angular/compiler-cli": "^ 6.0.0"

npm uninstall -g @angular/cli
npm cache verify
npm install -g @angular/cli@next

, :

ng new my-project
cd my-project
ng serve
+16

, , angular cli .

1.7.4 angular cli 6.0.8.

Angular Cli global-

npm uninstall -g angular-cli
npm cache clean 
npm install -g @angular/cli@latest

Angular Cli dev-

npm uninstall --save-dev angular-cli
npm install --save-dev @angular/cli@latest
npm install

npm: -

npm audit fix

, "angular.json": -

ng update @angular/cli --migrate-only --from=1.7.4

, :)

+16

, , --from --migrate-only

ng update @angular/cli -

+8

:

ng update @angular/cli --migrate-only --from=1.7.4


  • (.angular-cli.json)

  • (angular.json)

, , , . angular-cli.json angular.json.

+8

. package-lock.json. npm install. .

+7

:

node_modules

: npm install

( , 2 3 , , .)

+4

, , 'ng serve', angular.json.

angular.json

npm install -g '@angular/cli' ng _, cd project_folder, ng serve.

+3

ng update @angular/cli . ( npm), npm audit fix , . , . , , : npm audit fix --dry-run -json . , npm audit fix npm audit fix, json .

+3

, , , :

  1. package.json Angular CLI :

    "devDependencies": { ...
      "@angular/cli": "^6.0.8",
      ...
    }
    
  2. node_modules, :

    npm install
    
    ng update @angular/cli
    
  3. ( )

    ng build --prod
    
+3

, angular.json , - , angular.json .

+2

, .

ng update @angular/cli - --from = 1.6.4

angular-cli.json angular.json. .

. .

        Updating karma configuration
        Updating configuration
        Removing old config file (.angular-cli.json)
        Writing config file (angular.json)
        Some configuration options have been changed, please make sure to update any                                     
        npm scripts which you may have modified.
        DELETE .angular-cli.json
        CREATE angular.json (3599 bytes)
        UPDATE karma.conf.js (962 bytes)
        UPDATE src/tsconfig.spec.json (324 bytes)
        UPDATE package.json (1405 bytes)
        UPDATE tsconfig.json (407 bytes)
        UPDATE tslint.json (3026 bytes)
+1

Angular 5.2 6. https://update.angular.io/

8.9 . enter image description here

0

, rails, rails, .

0

. :

WORKDIR /usr/src

Dockerfile.

0

, @angular/cli @angular/compiler-cli . package.json.

...
"@angular/cli": "6.0.0-rc.3",
"@angular/compiler-cli": "^5.2.0",
...

, .

0

, , package.json ( package-lock.json). ,

  1. package.json
  2. angular-cli ( )

.. . , , .

0
~/Desktop $ ng serve

('angular.json') .

: ('angular.json') .

at WorkspaceLoader._getProjectWorkspaceFilePath (/usr/lib/node_modules/@angular/cli/models/workspace-loader.js:37:19)
at WorkspaceLoader.loadWorkspace (/usr/lib/node_modules/@angular/cli/models/workspace-loader.js:24:21)
at ServeCommand._loadWorkspaceAndArchitect (/usr/lib/node_modules/@angular/cli/models/architect-command.js:180:32)
at ServeCommand.<anonymous> (/usr/lib/node_modules/@angular/cli/models/architect-command.js:47:25)
at Generator.next (<anonymous>)
at /usr/lib/node_modules/@angular/cli/models/architect-command.js:7:71
at new Promise (<anonymous>)
at __awaiter (/usr/lib/node_modules/@angular/cli/models/architect-command.js:3:12)
at ServeCommand.initialize (/usr/lib/node_modules/@angular/cli/models/architect-command.js:46:16)
at Object.<anonymous> (/usr/lib/node_modules/@angular/cli/models/command-runner.js:87:23)

, Angular.

:

~/ /angularproject $ ng serve

0

Ionic 4 pwa. :

ng add @angular/pwa

... received an error message. After some attempts and errors, I found that when my project was created, the start command was incorrect. I used the version of Ionic 3:

ionic start myApp tabs --type=ionic-angular

And rightly so:

ionic start myApp tabs --type=angular

without type ionic-. This solved the error.

0
source

Just check your directory, you should run "ng serve" in the same directory where you created the project.

So, first go to your project directory.

0
source

Source: https://habr.com/ru/post/1696141/


All Articles