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 · 19 comments

Comments

Projects
None yet
@laxmikantprajapatigate6
Copy link

laxmikantprajapatigate6 commented Oct 3, 2018

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

@jantimon

This comment has been minimized.

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 Oct 3, 2018

@fabioelia

This comment has been minimized.

Copy link

fabioelia commented Oct 17, 2018

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

@jantimon

This comment has been minimized.

Copy link
Owner

jantimon commented Oct 19, 2018

@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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Owner

jantimon commented Oct 25, 2018

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

@Colmea

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

tonywong625 commented Dec 6, 2018

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

@1692325894

This comment has been minimized.

Copy link

1692325894 commented Dec 7, 2018

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

This comment has been minimized.

Copy link

snoblenet commented Dec 24, 2018

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

@bingalls

This comment has been minimized.

Copy link

bingalls commented Dec 24, 2018

@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

This comment has been minimized.

Copy link
Owner

jantimon commented Dec 25, 2018

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

AlexWang-16 commented Jan 1, 2019

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

adambreznicky commented Jan 16, 2019

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),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment