diff --git a/src/package-manager.js b/src/package-manager.js index a330cf87b..243f57da7 100644 --- a/src/package-manager.js +++ b/src/package-manager.js @@ -419,13 +419,17 @@ module.exports = class PackageManager { for (const packageDirPath of this.packageDirPaths) { if (fs.isDirectorySync(packageDirPath)) { - for (let packagePath of fs.readdirSync(packageDirPath)) { - packagePath = path.join(packageDirPath, packagePath); - const packageName = path.basename(packagePath); + + const packagePaths = fs.readdirSync(packageDirPath, { withFileTypes: true }) + .filter(dirent => dirent.isDirectory()) + .map(dirent => dirent.name); + + for (const packageName of packagePaths) { if ( !packageName.startsWith('.') && !packagesByName.has(packageName) ) { + const packagePath = path.join(packageDirPath, packageName); packages.push({ name: packageName, path: packagePath,