@@ -215,9 +215,24 @@ class IOSDebugService implements IDebugService {
215215 if ( this . $options . client ) {
216216 return ( ( ) => {
217217 let inspectorPath = path . join ( this . $projectData . projectDir , "node_modules" , inspectorNpmPackageName ) ;
218+
219+ // local installation takes precedence over cache
218220 if ( ! this . inspectorAlreadyInstalled ( inspectorPath ) . wait ( ) ) {
219- inspectorPath = this . $npmInstallationManager . install ( inspectorNpmPackageName , this . $projectData . projectDir , { dependencyType : "save-dev" } ) . wait ( ) ;
221+ let cachepath = this . $childProcess . exec ( "npm get cache" ) . wait ( ) . trim ( ) ;
222+ let version = this . $npmInstallationManager . getLatestCompatibleVersion ( inspectorNpmPackageName ) . wait ( ) ;
223+ let pathToPackageInCache = path . join ( cachepath , inspectorNpmPackageName , version ) ;
224+ let pathToUnzippedInspector = path . join ( pathToPackageInCache , "package" ) ;
225+
226+ if ( ! this . $fs . exists ( pathToPackageInCache ) . wait ( ) ) {
227+ this . $childProcess . exec ( `npm cache add ${ inspectorNpmPackageName } @${ version } ` ) . wait ( ) ;
228+ let inspectorTgzPathInCache = path . join ( pathToPackageInCache , "package.tgz" ) ;
229+ this . $childProcess . exec ( `tar -xf ${ inspectorTgzPathInCache } -C ${ pathToPackageInCache } ` ) . wait ( ) ;
230+ this . $childProcess . exec ( `npm install --prefix ${ pathToUnzippedInspector } ` ) . wait ( ) ;
231+ }
232+
233+ inspectorPath = pathToUnzippedInspector ;
220234 }
235+
221236 let inspectorSourceLocation = path . join ( inspectorPath , inspectorUiDir , "Main.html" ) ;
222237 let inspectorApplicationPath = path . join ( inspectorPath , inspectorAppName ) ;
223238
0 commit comments