question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`rpt2: options error TS2688 Cannot find type definition file` with TS 2.4

See original GitHub issue

Hi,

Moving on typescript 2.4.1 breaks transpilation.

Verbosity 3 trace (I replaced cwd)

rpt2: Typescript version: 2.4.1
rpt2: Options: {
    "clean": true,
    "verbosity": 3,
    "abortOnError": false,
    "check": true,
    "cacheRoot": "{cwd}/.rpt2_cache",
    "include": [
        "*.ts+(|x)",
        "**/*.ts+(|x)"
    ],
    "exclude": [
        "*.d.ts",
        "**/*.d.ts"
    ],
    "rollupCommonJSResolveHack": false,
    "tsconfig": "tsconfig.json" // file is present
}
rpt2: options error TS2688 Cannot find type definition file for 'mocha'.
rpt2: options error TS2688 Cannot find type definition file for 'node'.
rpt2: rollupConfig: {
    "entry": "./index.ts",
    "dest": "umd/index.js",
    "format": "umd",
    "moduleName": "Santech.Core",
    "plugins": [
        {}
    ],
    "external": [
        ""
    ]
}
rpt2: Ambient types:
rpt2:     {cwd}/node_modules/@types/mocha/index.d.ts // file is present
rpt2:     {cwd}/node_modules/@types/node/index.d.ts // file is present
rpt2: ambient types changed, redoing all semantic diagnostics
rpt2: cleaning cache: {cwd}/.rpt2_cache/214064424104a2d72baf4ffd272fdce93c6b7a9b
rpt2: transpiling '{cwd}/index.ts'
rpt2:     cache: '{cwd}/.rpt2_cache/214064424104a2d72baf4ffd272fdce93c6b7a9b/code/cache/6910cdcfa786703b677dcee336da7d03c4bfbfe3'
rpt2:     cache miss
rpt2:     cache: '{cwd}/.rpt2_cache/214064424104a2d72baf4ffd272fdce93c6b7a9b/syntacticDiagnostics/cache/6910cdcfa786703b677dcee336da7d03c4bfbfe3'
rpt2:     cache miss
rpt2:     cache: '{cwd}/.rpt2_cache/214064424104a2d72baf4ffd272fdce93c6b7a9b/semanticDiagnostics/cache/6910cdcfa786703b677dcee336da7d03c4bfbfe3'
rpt2:     cache miss
⚠️   rpt2: {cwd}/index.ts (1,15): semantic error TS2307 Cannot find module './lib/http'.
index.ts

⚠️   rpt2: {cwd}/index.ts (2,15): semantic error TS2307 Cannot find module './lib/jwt'.
index.ts

⚠️   rpt2: {cwd}/index.ts (3,15): semantic error TS2307 Cannot find module './lib/storage'.
index.ts

rpt2: dependency '{cwd}/lib/http.ts'
rpt2:     imported by '{cwd}/index.ts'
rpt2: resolving './lib/http'
rpt2:     to '{cwd}/lib/http.ts'
rpt2: transpiling '{cwd}/lib/http.ts'
rpt2:     cache: '{cwd}/.rpt2_cache/214064424104a2d72baf4ffd272fdce93c6b7a9b/code/cache/ef9ea006b79a2162a89f467df12986dbc8ebff68'
rpt2:     cache miss
🚨   Could not find file: '{cwd}/lib/http.ts'.
lib\http.ts

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "noImplicitAny": true,
    "strictNullChecks": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "declaration": true,
    "sourceMap": true,
    "outDir": "dist",
    "typeRoots": [
      "./node_modules/@types"
    ],
    "types": [
      "mocha",
      "node"
    ],
    "lib": [
      "dom",
      "es6",
      "es2016.array.include"
    ]
  },
  "files": [
    "./index.ts"
  ],
  "exclude": [
    "coverage",
    "dist",
    "docs",
    "node_modules"
  ]
}

Moving back on typescript 2.3.4 solves the problem.

Thanks anyway for the great job

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ezolenkocommented, Jun 29, 2017

Ok, this is probably fixed in master branch.

Could you switch to "rollup-plugin-typescript2": "github:ezolenko/rollup-plugin-typescript2#master", and try with your setup?

1reaction
paulsouchecommented, Jun 29, 2017

Yeah everything is fine now ! Thanks it was really fast !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixing TS2688: Cannot find type definition file in node_modules
The problem was the wrong typeRoots . Should use the default ./node_modules/@types.
Read more >
Cannot find type definition file for 'node' in TypeScript
To solve the error "Cannot find type definition file for node", install the `node` types by running `npm i -D @types/node`. If the...
Read more >
Error TS2688: Cannot find type definition file for 'node'
If am receiving this error when running the vtex link command: Webpack for react@3.x builder finished in 464ms with errors: [at-loader] ...
Read more >
cannot find module 'fs' or its corresponding type declarations.
I needed to import file system('fs') and 'path' global node methods in my app.ts file but it keeps throwing: error TS2307: Cannot find...
Read more >
msbuild fail Error TS2688 Build:Cannot find type definition file ...
TypeScript version is 2.3 (version 2.4 causes compilation exception). TypeScriptToolsVersion is set to 2.3 in csproj file. The same project fail in vsts....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found