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 [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] requires a peer of react@^0.14.0 || ^15.0.0 but none was installed.
npm WARN [email protected] 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 [email protected]: 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)"
me too!
This should be fixed in master (8ba2ad7) - we just need to cut a release.
it is also doesn't work in webpack2.2.0
@IZHQT if you look at the fix that @insin mentioned you'll see that he updated webpack to v2.2.0 in it. @insin any idea when the next release will be cut? thanks!
@insin is there any idea about next release resolving this issue?
Getting same error in webpack 2.2.1
well until they push a release. this works for me =>
npm install webpack-contrib/npm-install-webpack-plugin --save-dev
- __ - same
hi there. Wondering when the latest fix will be published in npm platform.
@ericclemmons could you publish a release pretty please? ;)
me too
same
same here, new release is highly needed
I have the same problem
@david-whitlark : Thanks for your solution. It works for me on ubuntu but I am wondring how did you figured out this solution ?
@eblonvia I realized that the fix had been committed to the repo, but had not been pushed to npm, so by telling npm to install directly from the repo instead of npm allowed me to use the updated code
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
quietoption - enabling it will silencenpm installoutput. - Check if modules are resolvable from the current working directory instead of checking
dependenciesanddevDependenciesinpackage.json.package.jsonis now optional - the plugin will no longer create it if it doesn't exist.- If
package.jsonexists, the plugin will--savenewly-installed dependencies to it as usual.
- Allow Webpack to attempt to resolve loaders first, as
module.resolveLoadersconfiguration 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.
Staled and fixed in master