'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'
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 1:[1]
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.
Solution 2:[2]
Make sure you have "types": ["node"] in your tsconfig.app.json file. Having it in tsconfig.json was not enough for me (Angular 12).
{
...
"compilerOptions": {
...
"types": ["node"]
},
...
}
Solution 3:[3]
Just to point out that it's the @types/node dev dependency that seems to be required to fix this issue. At least, that's what got rid of the error for me. – devklick Jul 8 at 8:42
npm i --save-dev @types/node //this should do the trick
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | fix |
| Solution 3 | Community |
