打字稿错误-找不到名称“进程" [英] typescript error - cannot find name 'process'

查看:83
本文介绍了打字稿错误-找不到名称“进程"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个带有express +打字稿并面临打字稿错误的新项目-找不到名称'processs'

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

package.json

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"
  }

我尝试遵循解决方案并添加了类型 tsconfig

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"
    ]
}

但我仍然会收到错误消息.我已经安装了npm(6.4.1)和node(8.14.0)来开始构建新项目.有人可以强调我在做什么错吗?

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?

推荐答案

您的新配置看起来正确.但是,如果打字机语言服务器仍使用tsconfig的先前版本,则可能必须重新启动它.为了在VS Code中执行此操作,请执行Ctrl+Shift+PReload WindowTypeScript: Restart TS server(如果可用).

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.

此外,您的依赖项中不需要tsc软件包,因为现在已弃用该软件包,并且typescript软件包随附了tsc可执行文件.

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

这篇关于打字稿错误-找不到名称“进程"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆