Cannot find module '@angular-devkit/core'

前端 未结 9 2143
感情败类
感情败类 2020-12-23 09:24

I have created a angular project with Angular CLI: 1.6.3 Node: 9.4.0 OS: linux x64 version. But when want to run my angular app with command ng serve then fetch this error

相关标签:
9条回答
  • 2020-12-23 09:26

    This can happen on different versions on angular-cli. You can install it manually with

     npm i -D @angular-devkit/core 
    

    -D is shortcut to --save-dev

    Or try the latest version of angular cli

    npm install --save-dev @angular/cli@latest
    
    0 讨论(0)
  • 2020-12-23 09:29

    package.json, change to "@angular/cli": "^1.6.5",

     "devDependencies": {
    "@angular/cli": "^1.6.5",
    "@angular/compiler-cli": "^5.0.0",
    

    Important, the version could be vary depends on what time.

    You really should run

     npm update -g @angular/cli 
    

    first, to get version, my is 1.6.5

    What does the "^" do?

     ~1.0.2 means to install version 1.0.2 or the latest patch version such as 1.0.4. 
    
      ^1.0.2 means to install version 1.0.2 or the latest minor or patch version such as 1.1.0.
    

    last, run this

       npm update
    
    0 讨论(0)
  • 2020-12-23 09:33

    Step1: Edit your package.json changing the line

    @angular/cli": "1.6.4"
    

    to

    @angular/cli": "^1.6.4"
    

    Step2:

    npm update -g @angular/cli 
    

    Step3:

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

    I was facing the exact same problem. These three did the tasks for me. You may like to see https://github.com/angular/angular-cli/issues/9307

    0 讨论(0)
  • 2020-12-23 09:33

    You can do

    First,

    Delete the node_modules folder

    Run npm install

    And add devkit to your dev dependancies with npm i -D @angular-devkit/core

    0 讨论(0)
  • 2020-12-23 09:39

    Try the following steps,

    Step 1:

    npm update -g @angular/cli

    Step 2:

    Edit your package.json changing the line

    "@angular/cli": "1.6.0",

    to

    "@angular/cli": "^1.6.0",

    STEP 3:

    npm update

    Refer the steps

    0 讨论(0)
  • 2020-12-23 09:46

    try this out

    npm install @angular-devkit/core --save-dev

    https://github.com/angular/devkit/issues/256

    try to update your angular cli

    https://github.com/angular/angular-cli/issues/9307

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