How to install express in typings?

后端 未结 5 1723
礼貌的吻别
礼貌的吻别 2021-02-07 08:23

I am trying to use expressjs in my app.

After installing it using typings install express --ambient --save, I run tsc, but I get two errors:

5条回答
  •  我在风中等你
    2021-02-07 09:13

    With Typescript 2.0(https://blogs.msdn.microsoft.com/typescript/2016/09/22/announcing-typescript-2-0/), now it is different:

    If you install typescript with the following command:

    npm install -g typescript@2.0
    

    You will have to install express typings with command

    npm install --save @types/express
    

    Instead of typings getting installed with ambient/global like in earlier releases. The typings get installed in node_modules/@types/express directory

    Your package.json will have the following fragment after doing npm install of types :

    "dependencies": {
        "@types/express": "^4.0.33"
      }
    

提交回复
热议问题