44 *--------------------------------------------------------------------------------------------*/
55
66const cp = require ( 'child_process' ) ;
7+ const path = require ( 'path' ) ;
78const npm = process . platform === 'win32' ? 'npm.cmd' : 'npm' ;
89
9- function npmInstall ( location ) {
10- const result = cp . spawnSync ( npm , [ 'install' ] , {
11- cwd : location ,
12- stdio : 'inherit'
13- } ) ;
10+ function npmInstall ( location , opts ) {
11+ opts = opts || { } ;
12+ opts . cwd = location ;
13+ opts . stdio = 'inherit' ;
14+
15+ const result = cp . spawnSync ( npm , [ 'install' ] , opts ) ;
1416
1517 if ( result . error || result . status !== 0 ) {
1618 process . exit ( 1 ) ;
@@ -43,4 +45,17 @@ const extensions = [
4345
4446extensions . forEach ( extension => npmInstall ( `extensions/${ extension } ` ) ) ;
4547
46- npmInstall ( `build` ) ; // node modules required for build
48+ function npmInstallBuildDependencies ( ) {
49+ // make sure we install gulp watch for the system installed
50+ // node, since that is the driver of gulp
51+ const env = Object . assign ( { } , process . env ) ;
52+
53+ delete env [ 'npm_config_disturl' ] ;
54+ delete env [ 'npm_config_target' ] ;
55+ delete env [ 'npm_config_runtime' ] ;
56+
57+ npmInstall ( path . join ( path . dirname ( __dirname ) , 'lib' , 'watch' ) , { env } ) ;
58+ }
59+
60+ npmInstall ( `build` ) ; // node modules required for build
61+ npmInstallBuildDependencies ( ) ; // node modules for watching, specific to host node version, not electron
0 commit comments