Cannot find module '@angular/core' in new

2019-07-24 14:09发布

问题:

I used swagger codegen to generate client side code, and when I try building the project (In visual studio code) I receive an error message stating "Cannot find module @angular/core. I ran npm install and npm run build at the root and successfully generated the node_modules folder. In the folder I do see the @angular folder and the core one beneath it, yet the project does not build and I am continuously receiving this error message.

ng -v:

Angular CLI: 6.1.2
Node: 8.11.3
OS: win32 x64
Angular: 6.1.1
... common, compiler, core, http, platform-browser

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.7.2 (cli-only)
@angular-devkit/core         0.7.2 (cli-only)
@angular-devkit/schematics   0.7.2 (cli-only)
@schematics/angular          0.7.2 (cli-only)
@schematics/update           0.7.2 (cli-only)
rxjs                         6.2.2
typescript                   3.0.1

I don't have any extensions installed, and the vs editor doesn't give me errors. Only when I build the project do I receive these errors.

Here is my tsconfig.json file:

{
    "compilerOptions": {
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "noImplicitAny": false,
        "suppressImplicitAnyIndexErrors": true,
        "target": "es5",
        "module": "es6",
        "moduleResolution": "node",
        "removeComments": true,
        "sourceMap": true,
        "outDir": "./dist",
        "noLib": false,
        "declaration": true,
        "lib": [ "es6", "dom" ]
    },
    "exclude": [
        "node_modules",
        "dist"
    ],
    "filesGlob": [
        "./model/*.ts",
        "./api/*.ts"
    ]
}

Any help would be appreciated!