@@ -145,9 +145,21 @@ export class PluginsService implements IPluginsService {
145
145
public ensureAllDependenciesAreInstalled ( ) : IFuture < void > {
146
146
return ( ( ) => {
147
147
let installedDependencies = this . $fs . exists ( this . nodeModulesPath ) . wait ( ) ? this . $fs . readDirectory ( this . nodeModulesPath ) . wait ( ) : [ ] ;
148
+ // Scoped dependencies are not on the root of node_modules,
149
+ // so we have to list the contents of all directories, starting with @
150
+ // and add them to installed dependencies, so we can apply correct comparison against package.json's dependencies.
151
+ _ ( installedDependencies )
152
+ . filter ( dependencyName => _ . startsWith ( dependencyName , "@" ) )
153
+ . each ( scopedDependencyDir => {
154
+ let contents = this . $fs . readDirectory ( path . join ( this . nodeModulesPath , scopedDependencyDir ) ) . wait ( ) ;
155
+ installedDependencies = installedDependencies . concat ( ...contents . map ( dependencyName => `${ scopedDependencyDir } /${ dependencyName } ` ) ) ;
156
+ } ) ;
157
+
148
158
let packageJsonContent = this . $fs . readJson ( this . getPackageJsonFilePath ( ) ) . wait ( ) ;
149
159
let allDependencies = _ . keys ( packageJsonContent . dependencies ) . concat ( _ . keys ( packageJsonContent . devDependencies ) ) ;
150
- if ( this . $options . force || _ . difference ( allDependencies , installedDependencies ) . length ) {
160
+ let notInstalledDependencies = _ . difference ( allDependencies , installedDependencies ) ;
161
+ if ( this . $options . force || notInstalledDependencies . length ) {
162
+ this . $logger . trace ( "Npm install will be called from CLI. Force option is: " , this . $options . force , " Not installed dependencies are: " , notInstalledDependencies ) ;
151
163
this . $npm . install ( this . $projectData . projectDir , this . $projectData . projectDir , { "ignore-scripts" : this . $options . ignoreScripts } ) . wait ( ) ;
152
164
}
153
165
} ) . future < void > ( ) ( ) ;
0 commit comments