error TS2307: Cannot find module '@angular/core'

后端 未结 4 1225
你的背包
你的背包 2020-12-16 19:43

So I get the following error when I tried building my application again:

ERROR in ../../../node_modules/@angular/cdk/a11y/typings/aria-describer/aria-describer

相关标签:
4条回答
  • 2020-12-16 19:50

    This problem apparently was being caused by the CDK and material modules of angular. I don't exactly know how it happend but I fixed it.

    I fixed it by following an answer in this github issue: https://github.com/angular/material2/issues/8306

    Solution

    To fix this issue you have to run the following commands:

    npm install --save @angular/material @angular/cdk
    rm -rf node_modules
    npm install
    
    0 讨论(0)
  • 2020-12-16 19:57

    In order to fix this issue you have to update to Angular CLI version, as @angular cdk 6.0 requires @angular core 6.0 version(updated version). Try to use updated version for both CLI and material/CDK

    Follow these steps:-

    npm uninstall -g @angular/cli
    npm cache verify
    

    if npm version is less than 5 then use npm cache clean

    npm install -g @angular/cli@latest
    

    then create new angluar/cli project after that install @angular/material and @angular/cdk.

    I hope this will solve your problem.

    0 讨论(0)
  • 2020-12-16 19:58

    I see that some solutions are radical, I would not to try that in the first place. My solution was not radical, and it did the job.

    I had the problem too, I did a simple npm update This was what came out:

    $> npm update
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    
    + rxjs@6.2.2
    + core-js@2.5.7
    added 2 packages from 6 contributors and audited 38996 packages in 13.315s
    found 0 vulnerabilities
    
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    
    + @types/jasminewd2@2.0.4
    updated 1 package and audited 38996 packages in 12.972s
    found 0 vulnerabilities
    

    And it solved the problem.

    0 讨论(0)
  • 2020-12-16 20:11

    For me problem got resolved when I make sure that @angular/material, @angular/ckd and @angular/animations versions are compatible with @angular/core version. Just edit package.json.

    In my case:

    "@angular/core": "^7.2.15",
    "@angular/animations": "^7.2.15",
    "@angular/material": "^7.3.3",
    "@angular/cdk": "^7.3.7",  
    
    0 讨论(0)
提交回复
热议问题