You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Cannot find type definition file for 'node'." for 2.4.1 #16772
typescript@^2.3.4:
- version "2.4.0"- resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.0.tgz#aef5a8d404beba36ad339abf079ddddfffba86dd"+ version "2.4.1"+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.1.tgz#c3ccb16ddaa0b2314de031e7e6fee89e5ba346bc"
$ yarn
$ npm run build
Expected behavior:
Compile.
Actual behavior:
ERROR in /Users/foo/Workspace/mercateo-ws/tsconfig.json
error TS2688: Cannot find type definition file for 'node'.
We are having the same problem, but it only seems to surface when running mocha with --require ts-node/register. Rolling back to 2.3.4 and will watch this issue.
Having same issues with all of our type definitions, which are:
ERROR in [censored]/tsconfig.json
error TS2688: Cannot find type definition file for 'amcharts'.
ERROR in [censored]/tsconfig.json
error TS2688: Cannot find type definition file for 'fs-extra'.
ERROR in [censored]/tsconfig.json
error TS2688: Cannot find type definition file for 'handlebars'.
ERROR in [censored]/tsconfig.json
error TS2688: Cannot find type definition file for 'highlight.js'.
ERROR in [censored]/tsconfig.json
error TS2688: Cannot find type definition file for 'jasmine'.
ERROR in [censored]/tsconfig.json
error TS2688: Cannot find type definition file for 'jquery'.
ERROR in [censored]/tsconfig.json
error TS2688: Cannot find type definition file for 'lodash'.
ERROR in [censored]/tsconfig.json
error TS2688: Cannot find type definition file for 'marked'.
ERROR in [censored]/tsconfig.json
error TS2688: Cannot find type definition file for 'minimatch'.
ERROR in [censored]/tsconfig.json
error TS2688: Cannot find type definition file for 'node'.
ERROR in [censored]/tsconfig.json
error TS2688: Cannot find type definition file for 'shelljs'.
ERROR in [censored]/tsconfig.json
error TS2688: Cannot find type definition file for 'webpack-env'.
For TypeScript 2.4.2 if you already have some custom "typeRoots": [ ... ] defined into your tsconfig.json and in your package.json you also are including "@types/node" and you work with the standard node functions like require, you will receive the error: Cannot find type definition file for 'node'.
You need to add ./node_modules/@types/ to your typeRoots array! see docs
Backstory: I had this problem because I use WebStorm IDE which uses tsc to compile the project, and webpack to compile it separately. Suddenly after removing some 3rd party node packages that I had I started having the above error. Now it's all good again.
Reacted by vinz243, Benny Neugebauer, holskil, iamjoyce and Dmitry Kurmanov
Serban Ghita (@serbanghita) you are the MVP here. Just note that the ./node_modules/@types/is relative to the directory where the tsconfig.json file is
I have a TypeScript app which imports another TypeScript app and I am receiving error TS2688: Cannot find type definition file for 'node'. from my imported module:
ode_modules/wire-webapp-cryptobox/dist/typings/wire-webapp-cryptobox.d.ts(18,23): error TS2688: Cannot find type definition file for 'node'.
I checked wire-webapp-cryptobox.d.ts(18,23) and it's this statement: /// <reference types="node" />
The config of "wire-webapp-cryptobox.d.ts" looks as follows:
Activity
andykellr commentedon Jun 27, 2017
We are having the same problem, but it only seems to surface when running mocha with
--require ts-node/register. Rolling back to 2.3.4 and will watch this issue.sgmccli commentedon Jun 27, 2017
Same issue here with ts-node/register. Fails to find all imported Types (@types) modules. I have reverted back to 2.3.4.
JnelsonEmarketer commentedon Jun 27, 2017
Ditto
johntran commentedon Jun 27, 2017
I've been debugging for the past 2.5 hours. Thank you for this issue. I was going insane.
RobARichardson commentedon Jun 28, 2017
Having the same issue, but for several other type definition files including angular, angular-material, and more. Had to revert back to 2.3.4.
JasonKleban commentedon Jun 28, 2017
I think this is also an issue with ts-loader. 'tsc -p .' works fine but as of this upgrade,
webpackwith ts-loader involved fails like this:(which is kinda weird because it looks like it built everything successfully before it errors out with this??)
Rolling back to 2.3.4 and the problem is gone.
teppeis commentedon Jun 28, 2017
similar issue: teppeis/typescript-simple#82
lkc0987 commentedon Jun 28, 2017
Having similar issues with type definitions. (node, jquery...)
enforced typescript version 2.4.0 using npm-shrinkwrap as a workaround
ldrick commentedon Jun 28, 2017
Having same issues with all of our type definitions, which are:
dashmug commentedon Jun 28, 2017
Same problem here.
skseth commentedon Jun 28, 2017
I had similar problems with ts-node, but tsc -p was fine. Upgrading to v3.1.0 fixed the problem.
26 remaining items
stephen commentedon Jun 28, 2017
Samuel Martins (@samwx) - I think this is a separate, unrelated change: #16472
samwx commentedon Jun 28, 2017
stephen (@stephen) Wow, that's true. Seems that typescript not supports imports like
@types/...anymore. Thank you!Fix for TS 2.4 Module Resolution Changes
virtustilus commentedon Jul 11, 2017
Reverted typescript from version 2.4.1 to 2.2.2 in package.json:
"typescript": "2.2.2",
and works fine now
fix ts-node types error (microsoft/TypeScript#16772 (comment))
sluukkonen commentedon Aug 21, 2017
For what it's worth, upgrading
ts-nodeto the latest version seems to fix this issue for me.serbanghita commentedon Sep 20, 2017
For TypeScript 2.4.2 if you already have some custom
"typeRoots": [ ... ]defined into yourtsconfig.jsonand in yourpackage.jsonyou also are including"@types/node"and you work with the standard node functions likerequire, you will receive the error:Cannot find type definition file for 'node'.You need to add
./node_modules/@types/to yourtypeRootsarray! see docsBackstory: I had this problem because I use WebStorm IDE which uses
tscto compile the project, andwebpackto compile it separately. Suddenly after removing some 3rd party node packages that I had I started having the above error. Now it's all good again.vinz243 commentedon Sep 26, 2017
Serban Ghita (@serbanghita) you are the MVP here. Just note that the
./node_modules/@types/is relative to the directory where thetsconfig.jsonfile isbennycode commentedon Sep 27, 2017
I have a TypeScript app which imports another TypeScript app and I am receiving
error TS2688: Cannot find type definition file for 'node'.from my imported module:I checked
wire-webapp-cryptobox.d.ts(18,23)and it's this statement:/// <reference types="node" />The config of "wire-webapp-cryptobox.d.ts" looks as follows:
{ "compilerOptions": { "declaration": false, "lib": ["es7", "dom"], "module": "commonjs", "moduleResolution": "node", "noEmitOnError": true, "noImplicitAny": false, "noImplicitReturns": true, "removeComments": true, "sourceMap": false, "target": "es5" }, "exclude": [ "bower_components", "node_modules", "typings/browser", "typings/browser.d.ts" ] }Can you tell me where I need to set
typeRootsto fix the error?Upgrade ts-loader to fix remaining @types issues :(( microsoft/TypeSc…
Upgrade ts-loader to fix remaining @types issues :(( microsoft/TypeSc…
Thaina commentedon Jan 22, 2018
I got this error with javascript triple slash reference too
I try to reference the global node module. Is it not possible?