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

this.htmlWebpackPlugin.getHooks is not a function #1068

Closed
laxmikantprajapatigate6 opened this issue Oct 3, 2018 · 20 comments
Closed

this.htmlWebpackPlugin.getHooks is not a function #1068

laxmikantprajapatigate6 opened this issue Oct 3, 2018 · 20 comments

Comments

@laxmikantprajapatigate6
Copy link

laxmikantprajapatigate6 commented Oct 3, 2018

Getting this error on Linux system, but it's working fine on windows system.

@jantimon
Copy link
Owner

jantimon commented Oct 3, 2018

Sorry the issue quality is very low.
Please prepare the issue so it can be solved.

@jantimon jantimon closed this as completed Oct 3, 2018
@fabioelia
Copy link

Maybe related to facebook/create-react-app#5465

@jantimon
Copy link
Owner

@fabioelia could you please tell me more about that?

getHooks is new in html-webpack-plugin 4.0.0.alpha-2

Older versions don't provide the static function.

@Colmea
Copy link

Colmea commented Oct 25, 2018

Having the same issue after installing alpha-2 and trying to build my app with webpack4 (and the config provided in react-create-app).

What information do you need to investigate @jantimon ?

Running on: Windows, node 8.12.0

@jantimon
Copy link
Owner

Maybe you have multiple html-webpack-plugin versions installed?

@Colmea
Copy link

Colmea commented Oct 25, 2018

Indeed, sorry for the false bug.
After a yarn list, it seems that I was using two html-webpack-plugin versions.

Everything's ok for me :)

@bingalls
Copy link

bingalls commented Nov 9, 2018

I am running on OSX 10.11, and I keep all software updated. I tried running npm audit fix --force on https://github.com/tongeren/react16 (actually chapter 8.1) and I am getting this error.
Upgrading to "html-webpack-plugin": "^4.0.0-beta.2" does not help. I ensured removing any relevant duplicate libraries.

@philihp
Copy link

philihp commented Nov 17, 2018

To add another data point here, I encountered this when upgrading react-dev-utils from
6.0.0-next.3e165448 to 6.1.1.

What resolved it was @kylealwyn's suggestion facebook/create-react-app#5465 (comment), where in my build.js I had to change

new InterpolateHtmlPlugin(env.raw),

to

new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),

@pixelass
Copy link

pixelass commented Nov 23, 2018

I'm getting this issue from html-webpack-harddisk-plugin.

https://github.com/jantimon/html-webpack-harddisk-plugin/blob/master/index.js#L22-L24

EDIT: seems like some other error in my process caused this one.

@tonywong625
Copy link

@philihp
changing to new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw), didnt work for me

@1692325894
Copy link

I'm updated a html-webpack-plugin from 3.2.0 to 4.0.0-alpha.2, but some problem happened yet.
Questions as follows:
yarn run v1.12.3
$ node scripts/start.js
this.htmlWebpackPlugin.getHooks is not a function
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@snoblenet
Copy link

4.0.0.alpha-2 of html-webpack-plugin is not listed on the releases page

@bingalls
Copy link

@snoblenet what is https://www.npmjs.com/package/html-webpack-plugin/v/4.0.0-alpha.2 ?
That might have been the latest, 2 months ago.
I've updated npm, and re-installed https://github.com/tongeren/react16 chapter 8.1
I still get high priority vulnerabilities that npm audit fix --force cannot resolve, but I am now not seeing html-webpack-plugin directly. May need further hacking.

@jantimon
Copy link
Owner

All published versions can be found here: https://www.npmjs.com/package/html-webpack-plugin?activeTab=versions

Please use npm i html-webpack-plugin@next

@DFASD
Copy link

DFASD commented Dec 31, 2018

when I update html-webpack-plugin for @4.0.0-beta.5 but there is another error. Cannot find module 'import-local' but I never import this module??

@AlexWang-16
Copy link

Just wanted to chime in on this issue. I have a react app created usingcreate-react-app. I got a warning from npm audit so I upgraded my packages to the latest and encountered this issue.

I executed npm i html-webpack-plugin@next as specified by @jantimon and it's at version 4.0.0-beta5, but I'm still getting the same error message when I run npm start on my project.

@DFASD
Copy link

DFASD commented Jan 1, 2019

I remove all the directory of node_modules . npm install again it is ok for me

@AlexWang-16
Copy link

AlexWang-16 commented Jan 1, 2019

Strange... I tried this again just now by removing node_modules after running npm i html-webpack-plugin@next and I'm still having issues. I'm not sure why it isn't working for me.

> service-animal@1.0.0 start /Users/awang/dev/service-animal
> node scripts/start.js

this.htmlWebpackPlugin.getHooks is not a function
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! service-animal@1.0.0 start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the service-animal@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/awang/.npm/_logs/2019-01-01T18_08_17_639Z-debug.log

@adambreznicky
Copy link

i just updated my create-react-app application from webpack 3 to 4 and got the this.htmlWebpackPlugin.getHooks is not a function error. it took a combination of suggestions in this tread to resolve it.

  1. delete old node_modules and reinstall fresh
  2. as per @jantimon, npm i html-webpack-plugin@next
  3. as per @philihp, new InterpolateHtmlPlugin(env.raw), to new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),

@CiprianDraghici
Copy link

@adambreznicky Thanks! It's working your solution.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests