node.jstypescriptexpress

typescript error - cannot find name 'process'


I am setting up a new project with express+ typescript and facing typescript error - cann't find name 'processs'enter image description here

package.json

"dependencies": {
    "express": "^4.16.4",
    "nodemon": "^1.18.7",
    "tsc": "^1.20150623.0",
    "typescript": "^3.1.6"
  },
  "devDependencies": {
    "@types/express": "^4.16.0",
    "@types/mocha": "^5.2.5",
    "@types/node": "^10.12.10",
    "eslint": "^5.9.0",
    "eslint-config-airbnb-base": "^13.1.0",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-promise": "^4.0.1",
    "mocha": "^5.2.0",
    "supertest": "^3.3.0",
    "typescript-eslint-parser": "^21.0.1"
  }

I tried to follow the solution and added types tsconfig

{
    "compilerOptions": {
      "target": "es6",
      "module": "commonjs",
      "outDir": "dist",
      "sourceMap": true,
      "types": ["node"] -----
    },
    "include": [
      "src/**/*.ts"
    ],
    "exclude": [
      "node_modules"
    ]
}

But I still get the error. I have installed npm (6.4.1) and node (8.14.0) to start building up my new project. Can someone highlight what I am doing wrong?


Solution

  • Your new configuration looks right. Although, you probably have to restart typescript language server if it still uses previous version of the tsconfig. In order to do this in VS Code, you do Ctrl+Shift+P and Reload Window or TypeScript: Restart TS server if available.

    Also you don't need tsc package in your dependencies, because it is deprecated now, and typescript package comes with tsc executable.