File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -281,7 +281,13 @@ if (!amMainInstance) {
281
281
const serverUpdatesPath = process . env . OCLIF_CLIENT_HOME ||
282
282
path . join ( oclifDataPath , 'client' ) ;
283
283
284
- const serverPaths = await fs . readdir ( serverUpdatesPath ) ;
284
+ const serverPaths = await fs . readdir ( serverUpdatesPath )
285
+ // Don't error if this path doesn't exist - that's normal at first
286
+ . catch ( ( e ) => {
287
+ if ( e . code === 'ENOENT' ) {
288
+ return [ ] as string [ ] ;
289
+ } else throw e ;
290
+ } ) ;
285
291
286
292
if ( serverPaths . some ( ( filename ) =>
287
293
! semver . valid ( filename . replace ( / \. p a r t i a l \. \d + $ / , '' ) ) &&
@@ -299,7 +305,7 @@ if (!amMainInstance) {
299
305
300
306
// If the bundled server is newer than all installed server versions, then
301
307
// delete all the installed server versions entirely before we start.
302
- if ( ! serverPaths . some ( ( serverPath ) => {
308
+ if ( serverPaths . length && ! serverPaths . some ( ( serverPath ) => {
303
309
try {
304
310
return semver . gt ( serverPath , BUNDLED_SERVER_VERSION )
305
311
} catch ( e ) {
You can’t perform that action at this time.
0 commit comments