fix: invalid version error when modules not installed (#4859)

fix #4781
This commit is contained in:
Yann Bertrand
2019-11-26 08:38:57 +01:00
committed by Haoqun Jiang
parent 2c13800051
commit ef2cbae66f
+4
View File
@@ -201,6 +201,10 @@ module.exports = class Upgrader {
const installed = await this.pm.getInstalledVersion(name)
const wanted = await this.pm.getRemoteVersion(name, range)
if (installed === 'N/A') {
throw new Error('At least one dependency is not installed. Please run npm install or yarn before trying to upgrade')
}
let latest = await this.pm.getRemoteVersion(name)
if (includeNext) {
const next = await this.pm.getRemoteVersion(name, 'next')