webpack-encore
webpack-encore copied to clipboard
Cannot find module 'tapable'
Hi @weaverryan ! This issue seems similar to https://github.com/symfony/webpack-encore/issues/727
When I run
yarn install --production
NODE_ENV=production ./node_modules/.bin/encore production
I get the error Cannot find module 'tapable'.
It seems that tapable is not installed in node_modules but in node_modules of enhanced-resolve library :

Adding tapable to the package.json solve the issue.
webpack-encore should not be able to install tapable ?
Hi @rgrassian,
Which version of yarn are you using?
Could you run the two following commands from an empty directory and give us the output?
$ yarn add @symfony/webpack-encore
$ yarn why tapable
@weaverryan I think the issue may come from the fact that webpack-manifest-plugin is currently embedded into Encore which causes tapable to be directly imported here: https://github.com/symfony/webpack-encore/blob/33b0c639da30c2fa4c4229426445109303d14c34/lib/webpack-manifest-plugin/hooks.js#L4
In most cases that shouldn't be an issue since at least one version of tapable (used in webpack and enhanced-resolve) is hoisted at the top-level... but that's probably not guaranteed since it is not declared as a direct dependency of Encore.
Hi @rgrassian,
Which version of
yarnare you using? 1.22.4Could you run the two following commands from an empty directory and give us the output?
$ yarn add @symfony/webpack-encore $ yarn why tapable
yarn why v1.22.4
warning package.json: No license field
[1/4] 🤔 Why do we have the module "tapable"...?
[2/4] 🚚 Initialising dependency graph...
warning No license field
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "[email protected]"
info Reasons this module exists
- "@symfony#webpack-encore#webpack" depends on it
- Hoisted from "@symfony#webpack-encore#webpack#tapable"
- Hoisted from "@symfony#webpack-encore#webpack#enhanced-resolve#tapable"
info Disk size without dependencies: "104KB"
info Disk size with unique dependencies: "104KB"
info Disk size with transitive dependencies: "104KB"
info Number of shared dependencies: 0
✨ Done in 0.49s.
@weaverryan I think the issue may come from the fact that
webpack-manifest-pluginis currently embedded into Encore which causestapableto be directly imported here:https://github.com/symfony/webpack-encore/blob/33b0c639da30c2fa4c4229426445109303d14c34/lib/webpack-manifest-plugin/hooks.js#L4
This is exactly where the error come from in my logs.
In most cases that shouldn't be an issue since at least one version of
tapable(used inwebpackandenhanced-resolve) is hoisted at the top-level... but that's probably not guaranteed since it is not declared as a direct dependency of Encore.
It's exactly the situation, when I run yarn, tapable is hosted at the top level (because of some devDepencies, but it's not when I run yarn --production, even if symfony/webpack-encore is in my dependencies.
yeah, as we embed the manifest plugin, we will need to define the plugin dependencies in our dependencies.