3

When developing locally in VS Code, packages are resolving to C:/Users/<User>/AppData/Local/Microsoft/TypeScript/3.5/node_modules/@types/<package>/index and not from the /node_modules directory local to the package.json.

I'm not getting any compiling errors or when deploying, but I can't wrap my head around why it's not resolving to the location I'd expect it to. Any idea why and how to fix it?

I'm using Node 8.12 and NPM 6.4.1.

Here's an example screenshot example

package.json

{
  "name": "superapp",
  "version": "0.0.1",
  "description": "",
  "main": "server.js",
  "scripts": {
    "start": "node server"
  },
  "keywords": [],
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.19.0",
    "dotenv": "^8.0.0",
    "express": "^4.17.1"
  }
}
halshing
  • 612
  • 2
  • 6
  • 17
  • You installed the package globally at some point. See the answer in for details on global package installation https://stackoverflow.com/questions/56827950/packages-installed-from-admin-cmd-powershell-not-added-to-path-for-regular-cmd-p/56828188?noredirect=1#comment100209865_56828188 – Adam Jul 01 '19 at 00:24

1 Answers1

0

Your module in question @types/express is not present in package.json

npm install @types/express --save-dev

You may have installed it globally previously and that is why it can be found in AppData as a backup solution for the compiler

klugjo
  • 19,422
  • 8
  • 57
  • 75