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

前端 未结 23 883
-上瘾入骨i
-上瘾入骨i 2020-11-28 01:10

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

When I updated @angular/cli versio

相关标签:
23条回答
  • 2020-11-28 01:36

    I had the same problem and found that there was no package.json in my project (but only the package-lock.json). I then

    1. restored the package.json from source control
    2. uninstalled the global and local angular-cli versions (like the instruction says)
    3. followed the standard upgrade procedure

    ..and all worked out fine. Took a while to figure it out, but that did it for me.

    0 讨论(0)
  • 2020-11-28 01:38

    For me what worked was creating a new Angular project and just copied the angular.json file in the project that had a problem due to the fact that the angular.json file was missing.

    0 讨论(0)
  • 2020-11-28 01:39

    Just check your directory, you must run "ng serve " on the same directory where you have created the project.

    So, first enter in your project directory.

    0 讨论(0)
  • 2020-11-28 01:40

    Uninstall the old version of Angular cli, and install Angular CLI global:

    Update Angular cli global package to the next version, "@angular/compiler-cli": "^6.0.0"

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

    Generate a new project and default application by running the following command:

    ng new my-project
    cd my-project
    ng serve
    
    0 讨论(0)
  • 2020-11-28 01:40

    Just run ng update @angular/cli in your console. You might find some vulnerabilities after running the command (if using npm), but then just runnpm audit fix in the console to fix them. This command will scan the project for any vulnerabilities and it will also fix compatibility issues by installing updates to these dependencies. If you do not wish to auto fix these vulnerabilities immediately, you can perform a Dry Run: by running npm audit fix --dry-run -json in the console. This will give you an idea of what the command npm audit fix will do, in the form of json in the console.

    0 讨论(0)
  • 2020-11-28 01:43

    Well, I faced the same issue as soon as I updated my angular cli version.

    Earlier I was using 1.7.4 and just now I upgraded it to angular cli 6.0.8.

    To update Angular Cli global:

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

    To update Angular Cli dev:

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

    To fix audit issues after npm install:

    npm audit fix
    

    To fix the issue related to "angular.json":

    ng update @angular/cli --migrate-only --from=1.7.4
    
    0 讨论(0)
提交回复
热议问题