install-webpack-plugin: Cannot read property 'plugin' of null

npm-install-webpack-plugin stop systematically with this error

TypeError: Cannot read property 'plugin' of null
    at NpmInstallPlugin.apply (/home/alexandre/Project_tests/npm-install-webpack-plugin/example/webpack2/node_modules/npm-install-webpack-plugin/src/plugin.js:50:28)

I am using the example provided in this repository: https://github.com/webpack-contrib/npm-install-webpack-plugin/tree/master/example/webpack2

When running npm run start, dependencies seems to be resolve but not not the loaders

Installing babel-core...
Installing babel-plugin-react-html-attrs...
Installing babel-preset-react...
Installing babel-preset-stage-0...
Installing babel-preset-react-hmre...
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN redbox-react@1.3.3 requires a peer of react@^0.14.0 || ^15.0.0 but none was installed.
npm WARN redbox-react@1.3.3 requires a peer of react-dom@^0.14.0 || ^15.0.0 but none was installed.
Installing peerDependencies...
Installing react...
Installing react-dom...
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

/home/alexandre/Project_tests/npm-install-webpack-plugin/example/webpack2/node_modules/webpack/bin/webpack.js:315
		throw e;
		^

TypeError: Cannot read property 'plugin' of null
    at NpmInstallPlugin.apply (/home/alexandre/Project_tests/npm-install-webpack-plugin/example/webpack2/node_modules/npm-install-webpack-plugin/src/plugin.js:50:28)
    at Compiler.apply (/home/alexandre/Project_tests/npm-install-webpack-plugin/example/webpack2/node_modules/tapable/lib/Tapable.js:306:16)
    at webpack (/home/alexandre/Project_tests/npm-install-webpack-plugin/example/webpack2/node_modules/webpack/lib/webpack.js:32:19)
    at processOptions (/home/alexandre/Project_tests/npm-install-webpack-plugin/example/webpack2/node_modules/webpack/bin/webpack.js:305:14)
    at Object.<anonymous> (/home/alexandre/Project_tests/npm-install-webpack-plugin/example/webpack2/node_modules/webpack/bin/webpack.js:363:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

node 6.9.5 (LTS) linux:

  • NAME=“Ubuntu”
  • VERSION=“16.04 LTS (Xenial Xerus)”

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 11
  • Comments: 18 (3 by maintainers)

Most upvoted comments

well until they push a release. this works for me =>

npm install webpack-contrib/npm-install-webpack-plugin --save-dev

@insin is there any idea about next release resolving this issue?

I’ve published npm-install-webpack2-plugin to npm in the meantime (which is built from b21bd32) as I need a non-scoped (don’t ask) Webpack 2 compatible version.

These are the draft release notes I had ready for the next release:

  • Added a quiet option - enabling it will silence npm install output.
  • Check if modules are resolvable from the current working directory instead of checking dependencies and devDependencies in package.json .
    • package.json is now optional - the plugin will no longer create it if it doesn’t exist.
    • If package.json exists, the plugin will --save newly-installed dependencies to it as usual.
  • Allow Webpack to attempt to resolve loaders first, as module.resolveLoaders configuration may enable resolving of loaders which aren’t resolvable from the current working directory.
  • Added support for Babel presets specified as a [preset, options] array.
  • Added compatibility for Webpack 2 creating resolvers later in the process.

@ericclemmons could you publish a release pretty please? 😉

hi there. Wondering when the latest fix will be published in npm platform.