我如何确定一个npm包是否有更新的版本?

我发现在我的package.json中放置一个不存在的版本会导致带有所有可用选项的错误信息。

例如,我使用了打字稿包的一个不存在的版本。

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

在调用命令“npm install”后,我得到这个有用的错误信息:

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

然后我得到所有可用版本的打字机列表,这是真正有用的。

我的问题是,如何直接得到这个可能的打字稿版本的列表,而不会暂停失败的NPM安装?

是:

 npm view typescript versions 

如果你只是想要最新的版本,请省略's':

 npm view typescript version