Heather92065
Heather92065

Reputation: 7893

How can I determine if an npm package has a more recent version available?

I have found that placing a version in my package.json that doesn't exist causes an error message with all the available choices.

For instance, I used a non-existent version of the typescript package.

{
  "name": "ang2-reg",
  "version": "1.0.0",
  "scripts": {
    "postinstall": "npm run typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "lite": "lite-server",
    "start": "concurrent \"npm run tsc:w\" \"npm run lite\" ",
    "typings" : "typings"
  },
  "license": "ISC",
  "dependencies": {
    "angular2": "2.0.0-beta.6",
    "systemjs": "0.19.20",
    "es6-promise": "^3.0.2",
    "es6-shim": "^0.33.3",
    "zone.js": "0.5.14"
  },
  "devDependencies": {
    "concurrently": "^1.0.0",
    "lite-server": "^2.1.0",
    "typescript": "^1.8.0.not-there",
    "typings":"^0.6.8"
  }
}

Upon invoking the command "npm install" I get this helpful error message:

npm ERR! No compatible version found: typescript@^1.8.0.not-there

Then I get a list of all the available versions of typescript which is really helpful.

My question is, how can I get this list of possible typescript versions directly without staging a failed npm install?

Upvotes: 1

Views: 201

Answers (1)

McMath
McMath

Reputation: 7188

Yes:

npm view typescript versions

And if you just want the latest version, omit the 's':

npm view typescript version

Upvotes: 4

Related Questions