webpack-contrib/install-webpack-plugin

repeatedly installs same modules

barbalex opened this issue · 7 comments

I installed npm-install-webpack-plugin on these two projects of mine:

Every time I run npm start several modules are installed. Not once but repeatedly. This prevents webpack from building during several minutes.

Here is the output:

PS C:\Users\alex\gs> npm start

> gs@1.0.0 start C:\Users\alex\gs
> hjs-dev-server

Installing `webpack-hot-middleware`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── webpack-hot-middleware@2.6.4

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Listening at http://localhost:3000
Installing `file`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── file@0.2.2  extraneous

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Installing `file`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── file@0.2.2  extraneous

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Installing `file`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── file@0.2.2  extraneous

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Installing `react-transform-hmr`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── react-transform-hmr@1.0.1

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Installing `file`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── file@0.2.2  extraneous

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Installing `file`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── file@0.2.2  extraneous

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Installing `file`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── file@0.2.2  extraneous

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Installing `file`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── file@0.2.2  extraneous

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Installing `react-transform-hmr`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── react-transform-hmr@1.0.1

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Installing `react-transform-hmr`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── react-transform-hmr@1.0.1

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Installing `react-transform-hmr`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── react-transform-hmr@1.0.1

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Installing `react-transform-hmr`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── react-transform-hmr@1.0.1

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Installing `react-transform-hmr`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── react-transform-hmr@1.0.1

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
Installing `react-transform-hmr`...
npm WARN install Couldn't install optional dependency: Unsupported
gs@1.0.0 C:\Users\alex\gs
└── react-transform-hmr@1.0.1

npm WARN EPACKAGEJSON gs@1.0.0 No repository field.
webpack built dd8ccb8a57a7a8d935d3 in 147687ms
webpack building...
webpack built dd8ccb8a57a7a8d935d3 in 133ms

I have the same issue when running webpack-dev-server. With every install I can see the build progress advancing.

 ~/D/w/react-toolbox-example on master ● node_modules/.bin/webpack-dev-server  --progress --colors
 70% 1/1 build moduleshttp://localhost:8080/webpack-dev-server/
webpack result is served from /
content is served from /Users/derek/Documents/workspace/react-toolbox-example
Installing `babel`...
npm WARN prefer global babel@6.3.26 should be installed with -g
react-toolbox-example@0.11.4 /Users/derek/Documents/workspace/react-toolbox-example
└── babel@6.3.26  extraneous

Installing `babel`...
npm WARN prefer global babel@6.3.26 should be installed with -g
runTopLevelLifecycles     ▌ ╢█████████████████████████████████████████████████████░░░░╟
react-toolbox-example@0.11.4 /Users/derek/Documents/workspace/react-toolbox-example
└── babel@6.3.26  extraneous

Installing `babel`...
loadAllDepsIntoIdealTree  ▐ ╢██████████████████████████████████████████░░░░░░░░░░░░░░░╟

Also I observed that most installs are marking packages as extraneous:

Installing `toolbox`...
react-toolbox-example@0.11.4 /Users/derek/Documents/workspace/react-toolbox-example
└── toolbox@0.1.1  extraneous

Some of this is related to #16. Otherwise, I think the issues @barbalex may be having is because he's on Windows, which I have no way of testing.

The way the internal installer works is that it checks if package.json already has the dependency installed &, if so, skips it. Sounds like the check is failing for Windows users.

nkbt commented

It could be related to some path checks. If you ever used / in your paths to compare - that could be the case. To be always safe, we wrap all path operations into path.join or path.resolve, they do all the necessary normalization.

Luckily I also have a mac.

The same issue occurs here:

alex-mac:gs alex$ npm start

> gs@1.0.0 start /Users/alex/gs
> hjs-dev-server

Installing `webpack-hot-middleware`...
gs@1.0.0 /Users/alex/gs
└── webpack-hot-middleware@2.6.4 

Listening at http://localhost:3000
Installing `file`...
gs@1.0.0 /Users/alex/gs
└── file@0.2.2  extraneous

Installing `file`...
gs@1.0.0 /Users/alex/gs
└── file@0.2.2  extraneous

Installing `file`...
gs@1.0.0 /Users/alex/gs
└── file@0.2.2  extraneous

Installing `react-transform-hmr`...
gs@1.0.0 /Users/alex/gs
└── react-transform-hmr@1.0.1 

Installing `file`...
gs@1.0.0 /Users/alex/gs
└── file@0.2.2  extraneous

Installing `file`...
gs@1.0.0 /Users/alex/gs
└── file@0.2.2  extraneous

Installing `file`...
gs@1.0.0 /Users/alex/gs
└── file@0.2.2  extraneous

Installing `file`...
gs@1.0.0 /Users/alex/gs
└── file@0.2.2  extraneous

Installing `react-transform-hmr`...
gs@1.0.0 /Users/alex/gs
└── react-transform-hmr@1.0.1 

Installing `react-transform-hmr`...
gs@1.0.0 /Users/alex/gs
└── react-transform-hmr@1.0.1 

Installing `react-transform-hmr`...
gs@1.0.0 /Users/alex/gs
└── react-transform-hmr@1.0.1 

Installing `react-transform-hmr`...
gs@1.0.0 /Users/alex/gs
└── react-transform-hmr@1.0.1 

Installing `react-transform-hmr`...
gs@1.0.0 /Users/alex/gs
└── react-transform-hmr@1.0.1 

Installing `react-transform-hmr`...
gs@1.0.0 /Users/alex/gs
└── react-transform-hmr@1.0.1 

webpack built ea4c8f3aab72d332762f in 248167ms

I just updated to v2.0.1 from 2.0.0. The issue persists

wait, maybe it works now

Seem like v2.0.1 solves the issue.

The first time I run npm start this happens:

PS C:\Users\alex\bb> npm start

> bb@1.0.0 start C:\Users\alex\bb
> hjs-dev-server

Installing `webpack-hot-middleware`...
npm WARN install Couldn't install optional dependency: Unsupported
bb@1.0.0 C:\Users\alex\bb
└── webpack-hot-middleware@2.6.4

Listening at http://localhost:3000
Installing `expose`...
npm WARN install Couldn't install optional dependency: Unsupported
bb@1.0.0 C:\Users\alex\bb
└── expose@0.1.4

Installing `file`...
npm WARN install Couldn't install optional dependency: Unsupported
bb@1.0.0 C:\Users\alex\bb
└── file@0.2.2

Installing `react-transform-hmr`...
npm WARN install Couldn't install optional dependency: Unsupported
bb@1.0.0 C:\Users\alex\bb
└── react-transform-hmr@1.0.1

Installing `html`...
npm WARN install Couldn't install optional dependency: Unsupported
bb@1.0.0 C:\Users\alex\bb
├─┬ html@0.0.10
│ └─┬ glob@3.2.11
│   └── minimatch@0.3.0
├─┬ stylus-loader@1.5.1
│ └─┬ stylus@0.52.4
│   └─┬ glob@3.2.11
│     └── minimatch@0.3.0
└─┬ yeticss@7.2.0
  └─┬ stylus@0.47.3
    └─┬ glob@3.2.11
      └── minimatch@0.3.0

Installing `style`...
npm WARN install Couldn't install optional dependency: Unsupported
bb@1.0.0 C:\Users\alex\bb
└── style@0.0.3

Installing `css`...
npm WARN install Couldn't install optional dependency: Unsupported
bb@1.0.0 C:\Users\alex\bb
├─┬ autoprefixer-stylus@0.9.1
│ └─┬ multi-stage-sourcemap@0.2.1
│   └── source-map@0.1.43
├─┬ css@2.2.1
│ ├── source-map@0.1.43
│ ├─┬ source-map-resolve@0.3.1
│ │ ├── atob@1.1.3
│ │ ├── resolve-url@0.2.1
│ │ └── source-map-url@0.3.0
│ └── urix@0.1.0
├─┬ exports-loader@0.6.2
│ └── source-map@0.1.43
├─┬ html-loader@0.4.0
│ └─┬ es6-templates@0.2.2
│   └─┬ recast@0.9.18
│     └── source-map@0.1.43
├─┬ imports-loader@0.6.5
│ └── source-map@0.1.43
└─┬ stylus-loader@1.5.1
  └─┬ stylus@0.52.4
    └── source-map@0.1.43

But beginning with the second time it's this:

C:\Users\alex\bb> npm start

> bb@1.0.0 start C:\Users\alex\bb
> hjs-dev-server

Listening at http://localhost:3000
webpack built ed25bb8dfdf2cef5c0b1 in 9111ms

That happens both on windows and the mac. And in both projects.

Thanks for your great tool and stellar issue solving!