我发现在我的package.json中放置一个不存在的版本会导致出现包含所有可用选项的错误消息。
例如,我使用了一个不存在的typescript包版本。
{
"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安装的情况下直接获取这些可能的打字稿版本列表?
答案 0 :(得分:4)
是:
npm view typescript versions
如果您只想要最新版本,请省略's':
npm view typescript version