Angularfire: Error TS2688: Cannot find type definition file for 'src'

Created on 18 Dec 2016  路  3Comments  路  Source: angular/angularfire

Hello,
I have tried every possible solution to fix this issue but none helps remove this error message.

Error:

error TS2688: Cannot find type definition file for 'src'.
error TS2688: Cannot find type definition file for 'tests'.

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [ "es2015", "dom" ],
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "typeRoots": [
      "./node_modules/@types/",
       "./node_modules/hammerjs"
    ]
  },
  "compileOnSave": true,
  "exclude": [
    "node_modules/*",
    "**/*-aot.ts"
  ]
}

systemjs.config.js

(function (global) {
  System.config({
    paths: {
      'npm:': 'node_modules/'
    },
    map: {
      app: 'app',

      // angular bundles
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',

      // other libraries
      'rxjs': 'npm:rxjs',
      'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
      '@angular/material': 'npm:@angular/material/material.umd.js'
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        main: './main.js',
        defaultExtension: 'js'
      },
      rxjs: {
        defaultExtension: 'js'
      }
    }
  });
})(this);

All 3 comments

@sharomet Doesn't helps a lot in debugging the issue. what's your node version, npm version etc. please follow the issue template and provide more details about your project. You can also share a plnkr of your project, if you like.

All issues have to follow the issue template provided. I understand this is asking a lot and is generally annoying when you feel your question is straightforward, but just trust that it's critical to keep things streamlined and manageable for our team. I'm closing this for now because it doesn't adhere to these requirements. Feel free to resubmit according to the template, being absolutely sure to include a working, minimal repro of the problem and version info.

Note that how-to questions are better suited for Stack Overflow or a discussion group.

For anyone else running into this issue:
I just encountered the error Cannot find type definition file for 'src' .

In my case, the error came from my tsconfig.json file > typeRoots > a type root path pointed to a folder A > folder A, itself, included a folder with a nested src folder. Typescript was trying to find a type definition file for that src folder and failing. I simply flattened the contents of folder A so that it only contained type definition files and the problem went away.

Was this page helpful?
0 / 5 - 0 ratings