Guillaume Alouege
Guillaume Alouege

Reputation: 790

Can't use @type/node with typescript 3.2

I can't use any type of @type/node with typescript 3.2

My tsconfig :

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false,
    "skipLibCheck": true,
    "suppressImplicitAnyIndexErrors": true,
    "outDir": "target/www/app",
    "lib": ["es7", "dom"],
    "baseUrl": "./",
    "paths": {
      "app/*": ["src/app/*"]
    },
    "types": ["node"],
    "importHelpers": true,
    "allowJs": true
  }
}

Version of typescript : 3.2.2 Version of @type/node : 11.13.5

I have this error message :

error TS2580: Cannot find name 'process'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.

I understand the error but didnt find a way of fixing it.

UPDATE :

npm ls --depth=0
+-- @angular-devkit/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/platform-server@^7.1.4
+-- @angular/[email protected]
+-- @fortawesome/[email protected]
+-- @fortawesome/[email protected]
+-- @fortawesome/[email protected]
+-- @ng-bootstrap/[email protected]
+-- @nguniversal/[email protected]
+-- @ngx-translate/[email protected]
+-- @ngx-translate/[email protected]
+-- @types/[email protected]
+-- @types/[email protected]
+-- @types/[email protected]
+-- @types/[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- UNMET PEER DEPENDENCY [email protected] - 3
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- UNMET PEER DEPENDENCY popper.js@^1.14.7
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]

npm ERR! peer dep missing: @angular/platform-server@^7.1.4, required by @nguniversal/[email protected]
npm ERR! peer dep missing: [email protected] - 3, required by [email protected]
npm ERR! peer dep missing: popper.js@^1.14.7, required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]

Upvotes: 2

Views: 5246

Answers (1)

Guillaume Alouege
Guillaume Alouege

Reputation: 790

My probleme was in tsconfig.app.json an another file using the tsconfig.json and extend it.

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

types was override :

"types": []

Removing this line fix the problem.

Upvotes: 10

Related Questions