Versions of @angular/compiler-cli and typescript could not be determined

前端 未结 11 2530
耶瑟儿~
耶瑟儿~ 2020-12-28 14:35

I have installed Angular/cli and then try to run command ng serve then below error is throwing. I have tried lot of thing like uninstall angular/cli, npm cache clean, etc

相关标签:
11条回答
  • 2020-12-28 14:59

    In the case of deployment, it is a good idea to add a preinstall script to address these gaps in dependencies:

    "preinstall": "npm install @angular/cli @angular/compiler-cli typescript"
    
    0 讨论(0)
  • 2020-12-28 14:59

    Also check these dependencies package.json:

    ...
    "@angular/cli": "x.x.x",
    "@angular/compiler": "^y.y.y",
    "@angular/compiler-cli": "^z.z.z",
    "typescript": "^t.t.t"
    ...
    

    Hope this helps...

    0 讨论(0)
  • 2020-12-28 15:00

    Please run the command

    npm --production=false install
    

    in your terminal. Also note that you should be in your project folder while executing this.

    0 讨论(0)
  • 2020-12-28 15:06

    First, for prevent, update angular

    npm install -g @angular/cli
    

    Second, also the run "npm install", you must install dev dependencies

    npm install --dev
    

    verify dependencies are without error

    ng --version
    
    0 讨论(0)
  • 2020-12-28 15:09

    Could you check that your "@angular/compiler" in your dependencies is compatible with angular/cli version.

    For example :

      "devDependencies": {
        "@angular/cli": "1.4.8",
        "@angular/compiler-cli": "4.4.6",
    

    is compatible with :

    "@angular/compiler": "4.4.6",
    
    0 讨论(0)
提交回复
热议问题