Angular 2x application configuration error

Asked

Viewed 129 times

0

I did some ***** in the advice that Visual Studio Code gives in some configuration file and what was working perfectly, now when running the ng serve gives the error to follow:

ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\common\http' in 'C:\mean\angular-crud-servicos\src\app'
ERROR in ./src/app/services/jogador.service.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\common\http' in 'C:\mean\angular-crud-servicos\src\app\services'
ERROR in ./src/app/services/post.service.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\common\http' in 'C:\mean\angular-crud-servicos\src\app\services'
ERROR in ./src/main.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src'
ERROR in ./src/app/app.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app'
ERROR in ./src/app/boostrap/cep/cep.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\boostrap\cep'
ERROR in ./src/app/bootstrap/alert/alert.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\bootstrap\alert'
ERROR in ./src/app/bootstrap/button/button.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\bootstrap\button'
ERROR in ./src/app/bootstrap/modal/modal.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\bootstrap\modal'
ERROR in ./src/app/jogador/jogador-form/jogador-form.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\jogador\jogador-form'
ERROR in ./src/app/login/login.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\login'
ERROR in ./src/app/post-list/post-list.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\post-list'
ERROR in ./src/app/post-save/post-save.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\post-save'
ERROR in ./src/app/services/local-storage.service.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\services'
ERROR in ./src/app/services/message.service.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\services'
ERROR in ./src/app/services/jogador.service.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\services'
ERROR in ./src/app/services/post.service.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\services'
ERROR in ./src/app/services/jwt-token.service.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\services'
ERROR in ./src/app/services/cep/cep.service.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\core' in 'C:\mean\angular-crud-servicos\src\app\services\cep'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\forms' in 'C:\mean\angular-crud-servicos\src\app'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\http' in 'C:\mean\angular-crud-servicos\src\app'
ERROR in ./src/app/login/login.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\http' in 'C:\mean\angular-crud-servicos\src\app\login'
ERROR in ./src/app/services/cep/cep.service.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\http' in 'C:\mean\angular-crud-servicos\src\app\services\cep'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\platform-browser' in 'C:\mean\angular-crud-servicos\src\app'
ERROR in ./src/main.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\platform-browser-dynamic' in 'C:\mean\angular-crud-servicos\src'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\router' in 'C:\mean\angular-crud-servicos\src\app'
ERROR in ./src/app/jogador/jogador-form/jogador-form.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\router' in 'C:\mean\angular-crud-servicos\src\app\jogador\jogador-form'
ERROR in ./src/app/login/login.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\router' in 'C:\mean\angular-crud-servicos\src\app\login'
ERROR in ./src/app/post-save/post-save.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\@angular\router' in 'C:\mean\angular-crud-servicos\src\app\post-save'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\ag-grid-angular' in 'C:\mean\angular-crud-servicos\src\app'
ERROR in (webpack)-dev-server/client/overlay.js
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\ansi-html' in 'C:\mean\angular-crud-servicos\node_modules\webpack-dev-server\client'
ERROR in ./src/polyfills.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\core-js\es7\reflect' in 'C:\mean\angular-crud-servicos\src'
ERROR in (webpack)-dev-server/client/overlay.js
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\html-entities' in 'C:\mean\angular-crud-servicos\node_modules\webpack-dev-server\client'
ERROR in (webpack)-dev-server/client?http://0.0.0.0:0
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\loglevel' in 'C:\mean\angular-crud-servicos\node_modules\webpack-dev-server\client'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\ng2-file-upload' in 'C:\mean\angular-crud-servicos\src\app'
ERROR in ./src/app/login/login.component.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\rxjs' in 'C:\mean\angular-crud-servicos\src\app\login'
ERROR in ./src/app/services/cep/cep.service.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\rxjs' in 'C:\mean\angular-crud-servicos\src\app\services\cep'
ERROR in (webpack)-dev-server/client/socket.js
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\sockjs-client\dist\sockjs' in 'C:\mean\angular-crud-servicos\node_modules\webpack-dev-server\client'
ERROR in (webpack)-dev-server/client?http://0.0.0.0:0
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\strip-ansi' in 'C:\mean\angular-crud-servicos\node_modules\webpack-dev-server\client'
ERROR in (webpack)-dev-server/client?http://0.0.0.0:0
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\url' in 'C:\mean\angular-crud-servicos\node_modules\webpack-dev-server\client'
ERROR in (webpack)-dev-server/client?http://0.0.0.0:0
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\webpack\hot\emitter' in 'C:\mean\angular-crud-servicos\node_modules\webpack-dev-server\client'
ERROR in ./src/polyfills.ts
Module not found: Error: Can't resolve 'C:\mean\angular-crud-servicos\types\zone.js\dist\zone' in 'C:\mean\angular-crud-servicos\src'
i 「wdm」: Failed to compile.

I’ve reinstalled with npm installbut I’m sure it’s in some environment configuration file. Someone has already gone through it and how it fixed?

Thank you.

Follow my configuration files:

tslint.json:

{
  "rulesDirectory": [
    "node_modules/codelyzer"
  ],
  "rules": {
    "arrow-return-shorthand": true,
    "callable-types": true,
    "class-name": true,
    "comment-format": [
      true,
      "check-space"
    ],
    "curly": true,
    "deprecation": {
      "severity": "warn"
    },
    "eofline": true,
    "forin": true,
    "import-blacklist": [
      true,
      "rxjs/Rx"
    ],
    "import-spacing": true,
    "indent": [
      true,
      "spaces"
    ],
    "interface-over-type-literal": true,
    "label-position": true,
    "max-line-length": [
      true,
      140
    ],
    "member-access": false,
    "member-ordering": [
      true,
      {
        "order": [
          "static-field",
          "instance-field",
          "static-method",
          "instance-method"
        ]
      }
    ],
    "no-arg": true,
    "no-bitwise": true,
    "no-console": [
      true,
      "debug",
      "info",
      "time",
      "timeEnd",
      "trace"
    ],
    "no-construct": true,
    "no-debugger": true,
    "no-duplicate-super": true,
    "no-empty": false,
    "no-empty-interface": true,
    "no-eval": true,
    "no-inferrable-types": [
      true,
      "ignore-params"
    ],
    "no-misused-new": true,
    "no-non-null-assertion": true,
    "no-redundant-jsdoc": true,
    "no-shadowed-variable": true,
    "no-string-literal": false,
    "no-string-throw": true,
    "no-switch-case-fall-through": true,
    "no-trailing-whitespace": true,
    "no-unnecessary-initializer": true,
    "no-unused-expression": true,
    "no-use-before-declare": true,
    "no-var-keyword": true,
    "object-literal-sort-keys": false,
    "one-line": [
      true,
      "check-open-brace",
      "check-catch",
      "check-else",
      "check-whitespace"
    ],
    "prefer-const": true,
    "quotemark": [
      true,
      "single"
    ],
    "radix": true,
    "semicolon": [
      true,
      "always"
    ],
    "triple-equals": [
      true,
      "allow-null-check"
    ],
    "typedef-whitespace": [
      true,
      {
        "call-signature": "nospace",
        "index-signature": "nospace",
        "parameter": "nospace",
        "property-declaration": "nospace",
        "variable-declaration": "nospace"
      }
    ],
    "unified-signatures": true,
    "variable-name": false,
    "whitespace": [
      true,
      "check-branch",
      "check-decl",
      "check-operator",
      "check-separator",
      "check-type"
    ],
    "no-output-on-prefix": true,
    "use-input-property-decorator": true,
    "use-output-property-decorator": true,
    "use-host-property-decorator": true,
    "no-input-rename": true,
    "no-output-rename": true,
    "use-life-cycle-interface": true,
    "use-pipe-transform-interface": true,
    "component-class-suffix": true,
    "directive-class-suffix": true
  }
}

tsconfig.json:

{
  "compileOnSave": false,
  "compilerOptions": {
    "paths": { "*": ["types/*"] },
    "paths": { "*": ["types/*"] },
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}

angular json.:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "angular-crud-servicos": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/angular-crud-servicos",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.css"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "angular-crud-servicos:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "angular-crud-servicos:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "angular-crud-servicos:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "src/karma.conf.js",
            "styles": [
              "src/styles.css"
            ],
            "scripts": [],
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "angular-crud-servicos-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "angular-crud-servicos:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "angular-crud-servicos:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "angular-crud-servicos"
}

If you need another configuration file let me know. :/

  • 1

    Try to run in the directory of your application: npm install

  • Had done it before.

  • I did. I can’t keep looking for the ** I did, I generated a new project and copied the project folders without the configuration files and it worked. Now... where I accepted the suggestion of the VSC that caused all this error, I do not know.

  • 1

    Branches is why it is cool to have all the code versioning, mainly the configuration files. So you could know exactly what caused it.

  • I’m gonna start doing....

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.