I have a new project, but when execute ng serve, I get error

后端 未结 6 1841
予麋鹿
予麋鹿 2021-02-02 15:12

I need to change this topic, I cant post new topic. I have update the script, and install new package. I still get errors but not the one I post last.

                    


        
相关标签:
6条回答
  • 2021-02-02 15:31

    Angular 6 looks for angular.json instead of angular-cli.json.

    You need to update your @angular/cli. Adding to the above answer

    I did update all the package with the following commands and updated all dependencies too. So as to remove all compatibility issues with other packages.

    If you are starting your app or demo app, follow this procedure. Be extra careful if you are doing this for production app.

    npm install -g npm-check-updates
    ncu -u
    ng update @angular/cli
    npm install
    

    Install npm-check-updates

    npm install -g npm-check-updates 
    

    Use ncu to update your package.json

    ncu for display

    ncu -u for re-writing your package.json

    Update your @angular/cli to modify your application to be compatible with angular 6

    ng update @angular/cli 
    

    and run npm install to update your packages

    0 讨论(0)
  • 2021-02-02 15:34

    That seems to be caused by different version of angular-cli is installed. I just created a new project, using new command, then copied across the src directory. then compiled them all successfully.

        ng new UX7
    
    0 讨论(0)
  • 2021-02-02 15:41

    I would recommend reading this:

    https://www.techiediaries.com/updating-angular-cli-projects/

    On this page it states:

    Angular 6 uses angular.json instead of angular-cli.json. This can be achieved using :

    ng update @angular/cli
    

    This solved my issue.

    Good luck

    0 讨论(0)
  • 2021-02-02 15:42

    Re-Install @angular/cli

    npm install @angular/cli
    
    0 讨论(0)
  • 2021-02-02 15:45

    Just use the official upgrade guide which will tell you what you need to do for your own particular needs:

    https://update.angular.io/

    0 讨论(0)
  • 2021-02-02 15:49

    In my case I just needed to close/reopen my terminal after I had remove/reclone a repo. Not sure what happened there.

    0 讨论(0)
提交回复
热议问题