Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error TS2688: Cannot find type definition file for 'node'. #213

Closed
dirtyvader opened this issue Oct 3, 2016 · 24 comments
Closed

error TS2688: Cannot find type definition file for 'node'. #213

dirtyvader opened this issue Oct 3, 2016 · 24 comments

Comments

@dirtyvader
Copy link

  • Updated my project to angular 2.0.1
  • Updated typings to latest: npm run typings -- install dt~node --save --global
  • Updated angular2-modal to 2.0.0 (When I start the project, it was 2.0.0-beta13)
@shlomiassaf
Copy link
Owner

@dirtyvader angular2-modal doesn't require you to install typings.
I use @types

@cksdnjs4113
Copy link

This error also appears in my project after reinstalling angula2-modal.
It was working fine before..

node_modules/angular2-modal/esm/models/errors.d.ts(1,1): error TS2688: Cannot find type definition file for 'node'.
node_modules/angular2-modal/esm/providers/modal.d.ts(1,1): error TS2688: Cannot find type definition file for 'node'.

@lyorix
Copy link

lyorix commented Oct 4, 2016

I was using the angular2-modal@2.0.0-beta13 with angular@2.0.0 without any issue (except #207).
I updated my project with angula@2.0.1 & angular2-modal@2.0.0-beta14 for AoT compilation support.
I have now the same issue dirtyvader mentioned:
node_modules/angular2-modal/esm/models/errors.d.ts(1,1): error TS2688: Cannot find type definition file for 'node'.
node_modules/angular2-modal/esm/providers/modal.d.ts(1,1): error TS2688: Cannot find type definition file for 'node'.

Any idea?
Thx

@cksdnjs4113
Copy link

Just adding more info above, I have replaced previous installed angular2-modal in the node_module. It works fine, however, as soon as I reinstall the angular2-modal, the error above appears again. I'm using 2.0.0-beta13

@shlomiassaf
Copy link
Owner

Can you each write the import method you use?webpack? SystemJS? Etc...

@cksdnjs4113
Copy link

I use systemjs

@lukaskopenec
Copy link

I am using webpack, but I am having the same issue. No problem with the same configuration in beta 13.

@dirtyvader
Copy link
Author

SystemJS too. Settings not changed since it worked (angular 2.0.0 & angular2-modal beta 13)

@tlorenzetti
Copy link

Same here with Webpack. The same configuration worked with angular-2.0.0 and angular2-modal beta.13.

@lyorix
Copy link

lyorix commented Oct 5, 2016

The error appears during transpilation process (running tsc): "compilerOptions": {"target": "es5","module": "commonjs","moduleResolution": "node"

@CaselIT
Copy link
Contributor

CaselIT commented Oct 5, 2016

@shlomiassaf
The first line on both esm/models/errors.d.ts and esm/providers/modal.d.ts is /// <reference types="node" />.
Removing it removes the compilation problem.

@kisdaniel
Copy link

I have a same bug with"angular2-modal": "^2.0.0-beta.13",:

node_modules/angular2-modal/esm/models/errors.d.ts(1,1): error TS2688: Cannot find type definition file for 'node'.
node_modules/angular2-modal/esm/providers/modal.d.ts(1,1): error TS2688: Cannot find type definition file for 'node'.

@kisdaniel
Copy link

my package.json:

{
  "name": "admin-ui",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common": "~2.0.1",
    "@angular/compiler": "~2.0.1",
    "@angular/compiler-cli": "0.6.3",
    "@angular/core": "~2.0.1",
    "@angular/forms": "~2.0.1",
    "@angular/http": "~2.0.1",
    "@angular/platform-browser": "~2.0.1",
    "@angular/platform-browser-dynamic": "~2.0.1",
    "@angular/router": "~3.0.1",
    "@angular/upgrade": "~2.0.1",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.12",
    "systemjs": "0.19.39",
    "zone.js": "^0.6.25",
    "angular2-in-memory-web-api": "0.0.21",

    "angular2-modal": "^2.0.0-beta.12",
    "bootstrap": "^3.3.7",
    "font-awesome": "^4.6.3",
    "jquery": "^3.1.1",
    "momentjs": "^1.1.17",
    "ng2-translate": "^2.5.0"
  },
  "devDependencies": {
    "concurrently": "^3.0.0",
    "tslint": "^3.15.1",
    "lite-server": "^2.2.0",
    "typescript": "^2.0.3",
    "typings": "^1.4.0"
  }
}

@halfonf
Copy link

halfonf commented Oct 5, 2016

To me, you all have to migrate to typescript 2.0 remove the typings and import the @typing libs, including the @typings/node lib in your package.json.

I had this issue and it solved it.

@dirtyvader
Copy link
Author

dirtyvader commented Oct 5, 2016

@halfonf Can you explain more about that ? I'm new to typescript and typings

@CaselIT
Copy link
Contributor

CaselIT commented Oct 5, 2016

@halfonf you should not have to use the node typings in the front-end since you are not running on node but in the browser.

@CaselIT
Copy link
Contributor

CaselIT commented Oct 5, 2016

@kisdaniel you have "angular2-modal": "^2.0.0-beta.12" so it's likely that npm installed the v.2.0.0. Change it to "angular2-modal": "2.0.0-beta.13" and the problem should not be there anymore. Of course then you cannot use angular 2.0.1...

@shlomiassaf
Copy link
Owner

Hi guys
I'll issue a fix later today
Thanks

@kisdaniel
Copy link

can anyone explain which version is compatible with angular 2.0.1?

package.json

{
  "name": "fet-admin-ui",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common": "~2.0.1",
    "@angular/compiler": "~2.0.1",
    "@angular/compiler-cli": "0.6.3",
    "@angular/core": "~2.0.1",
    "@angular/forms": "~2.0.1",
    "@angular/http": "~2.0.1",
    "@angular/platform-browser": "~2.0.1",
    "@angular/platform-browser-dynamic": "~2.0.1",
    "@angular/router": "~3.0.1",
    "@angular/upgrade": "~2.0.1",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.12",
    "systemjs": "0.19.39",
    "zone.js": "^0.6.25",
    "angular2-in-memory-web-api": "0.0.21",

    "angular2-modal": "^2.0.0",
    "bootstrap": "^3.3.7",
    "font-awesome": "^4.6.3",
    "jquery": "^3.1.1",
    "momentjs": "^1.1.17",
    "ng2-translate": "^2.5.0"
  },
  "devDependencies": {
    "concurrently": "^3.0.0",
    "tslint": "^3.15.1",
    "lite-server": "^2.2.0",
    "typescript": "^2.0.3",
    "typings": "^1.4.0"
  }
}

typings.json:

{
  "globalDependencies": {
    "core-js": "registry:dt/core-js#0.0.0+20160725163759",
    "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
    "node": "registry:dt/node#6.0.0+20160909174046"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  }
}

it has a same issue:

node_modules/angular2-modal/esm/models/errors.d.ts(1,1): error TS2688: Cannot find type definition file for 'node'.
node_modules/angular2-modal/esm/providers/modal.d.ts(1,1): error TS2688: Cannot find type definition file for 'node'.

@HassanIsCoding
Copy link

trying to Migrate from Angular 2 to angular 4
Got these two errors now:
Build:Cannot Find type definition file for 'mocha'
Build:Cannot Find type definition file for 'node'

@nebiljabari
Copy link

nebiljabari commented May 18, 2017

@Hassan121Cs I don't use Mocha but I solved :

Build:Cannot Find type definition file for 'node'

By re-importing the specific @types/node package used by my project.
In my case : $ npm i -D @types/node@6.0.10

Then modifing the variable at line 85 in node_modules/@types/node/index.d.ts
from : declare var module: NodeModule; to : declare var module: {id: string};
(causing an error)

@ghost
Copy link

ghost commented Sep 25, 2017

add types in your tsconfig file

{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2016", "dom" ],
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"types": [ <<<=============================================
"node"
]
}
}

@sophiewjzhang
Copy link

sophiewjzhang commented Dec 17, 2018

This worked perfectly. Thanks for the tip.
The change I made: in my tsconfig.json:
{
...
"compilerOptions": {
...
"types": ["node"]
...
},
...
}

@dcsan
Copy link

dcsan commented Dec 27, 2018

@parassachapara please triple quote code! with > ` marks
https://guides.github.com/features/mastering-markdown/#examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests