Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'plugin' of null #105

Closed
xNok opened this issue Feb 5, 2017 · 18 comments
Closed

Cannot read property 'plugin' of null #105

xNok opened this issue Feb 5, 2017 · 18 comments

Comments

@xNok
Copy link

xNok commented Feb 5, 2017

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)"
@hetchzhao
Copy link

me too!

@insin
Copy link
Collaborator

insin commented Feb 6, 2017

This should be fixed in master (8ba2ad7) - we just need to cut a release.

@hetchzhao
Copy link

it is also doesn't work in webpack2.2.0

@mburdz
Copy link

mburdz commented Feb 6, 2017

@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!

@xiongchengqing
Copy link

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

@flexzero
Copy link

flexzero commented Mar 3, 2017

Getting same error in webpack 2.2.1

@david-whitlark
Copy link

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

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

@Jorybraun
Copy link

  • __ - same

@lcxfs1991
Copy link
Contributor

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

@JSteunou
Copy link
Contributor

JSteunou commented May 3, 2017

@ericclemmons could you publish a release pretty please? ;)

@anztrax
Copy link

anztrax commented May 4, 2017

me too

@digitaldeus
Copy link

same

@johadi
Copy link

johadi commented May 8, 2017

same here, new release is highly needed

@Afelua
Copy link

Afelua commented May 8, 2017

I have the same problem

@eblonvia
Copy link

@david-whitlark : Thanks for your solution.
It works for me on ubuntu but I am wondring how did you figured out this solution ?

@david-whitlark
Copy link

@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

@insin
Copy link
Collaborator

insin commented May 27, 2017

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.

@alexander-akait
Copy link
Member

Staled and fixed in master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests