Cannot find module '@angular/compiler'

前端 未结 7 972
南方客
南方客 2020-12-13 13:42

I run the command npm install -g @angular/cli and after i tried to run my app it says, Cannot find module \'@angular/compiler\' in the terminal. How can i install the compil

相关标签:
7条回答
  • 2020-12-13 14:04

    Just to add to this. You will get this error too, when you are running ng serve not from within your project folder. So always make sure your bash runs from your project folder.

    0 讨论(0)
  • 2020-12-13 14:05

    Try to delete that "angular/cli": "1.0.0-beta.28.3", in the devDependencies it is useless , and add instead of it "@angular/compiler-cli": "^2.3.1", (since it is the current version, else add it by npm i --save-dev @angular/compiler-cli ), then in your root app folder run those commands:

    1. rm -r node_modules (or delete your node_modules folder manually)
    2. npm cache clean (npm > v5 add --force so: npm cache clean --force)
    3. npm install
    0 讨论(0)
  • 2020-12-13 14:09

    In my case this was required:
    npm install @angular/compiler --save
    npm install @angular/cli --save-dev

    0 讨论(0)
  • 2020-12-13 14:13

    Try this

    1. npm uninstall angular-cli
    2. npm install @angular/cli --save-dev
    0 讨论(0)
  • 2020-12-13 14:14

    Uninstall the Angular CLI and install the latest version of it.

    npm uninstall angular-cli
    
    npm install --save-dev @angular/cli@latest
    
    0 讨论(0)
  • 2020-12-13 14:16

    I just run npm install and then ok.

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