File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,13 @@ export class ModuleConfigUtil {
106106 const moduleDirSet = new Set < string > ( ) ;
107107 for ( const packagePath of packagePaths ) {
108108 const absolutePkgPath = path . join ( baseDir , packagePath ) ;
109- const realPkgPath = fs . realpathSync ( absolutePkgPath ) ;
109+ let realPkgPath ;
110+ try {
111+ realPkgPath = fs . realpathSync ( absolutePkgPath ) ;
112+ } catch ( _ ) {
113+ continue ;
114+ }
115+
110116 const moduleDir = path . dirname ( realPkgPath ) ;
111117
112118 // skip the symbolic link
@@ -141,7 +147,12 @@ export class ModuleConfigUtil {
141147
142148 private static readModuleFromNodeModules ( baseDir : string ) {
143149 const ref : ModuleReference [ ] = [ ] ;
144- const pkgContent = fs . readFileSync ( path . join ( baseDir , 'package.json' ) , 'utf8' ) ;
150+ let pkgContent : string ;
151+ try {
152+ pkgContent = fs . readFileSync ( path . join ( baseDir , 'package.json' ) , 'utf8' ) ;
153+ } catch ( _ ) {
154+ return [ ] ;
155+ }
145156 const pkg = JSON . parse ( pkgContent ) ;
146157 if ( ! fs . existsSync ( path . join ( baseDir , '/node_modules' ) ) ) {
147158 return ref ;
You can’t perform that action at this time.
0 commit comments