Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding out npm version from package-lock.json

I have a node app built with an unknown node and npm version. Is there any way to guess the version, or at least a version range, from package-lock.json?

I do have "lockfileVersion": 1,, which means npm v5 or v6. Any way I can get more granularity?

The reason I need it is, I am getting a bunch of errors like these when running ts-node, unless I delete and rebuild package-lock.json. Which I'd rather not do, for various reasons.

      ts.Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
like image 460
Irina Rapoport Avatar asked Dec 16 '25 23:12

Irina Rapoport


1 Answers

Simply search for "@types/node" inside package.json. It will give you node version used. Now search the relative npm version installed for the node version.

"@types/node": {
      "version": "16.9.4",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.4.tgz",
      "integrity": "sha512-KDazLNYAGIuJugdbULwFZULF9qQ13yNWEBFnfVpql......",
      "dev": true
    },
like image 118
NevetsKuro Avatar answered Dec 19 '25 18:12

NevetsKuro