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) {
281281 const serverUpdatesPath = process . env . OCLIF_CLIENT_HOME ||
282282 path . join ( oclifDataPath , 'client' ) ;
283283
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+ } ) ;
285291
286292 if ( serverPaths . some ( ( filename ) =>
287293 ! semver . valid ( filename . replace ( / \. p a r t i a l \. \d + $ / , '' ) ) &&
@@ -299,7 +305,7 @@ if (!amMainInstance) {
299305
300306 // If the bundled server is newer than all installed server versions, then
301307 // delete all the installed server versions entirely before we start.
302- if ( ! serverPaths . some ( ( serverPath ) => {
308+ if ( serverPaths . length && ! serverPaths . some ( ( serverPath ) => {
303309 try {
304310 return semver . gt ( serverPath , BUNDLED_SERVER_VERSION )
305311 } catch ( e ) {
You can’t perform that action at this time.
0 commit comments