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

Error: Cannot find module 'extract-text-webpack-plugin' with [email protected] #214

Closed
thangngoc89 opened this issue Jul 11, 2017 · 22 comments

Comments

@thangngoc89
Copy link
Collaborator

thangngoc89 commented Jul 11, 2017

$ preact -v 
1.3.0

$ npm -v 
5.2.0

Error:

Error: Cannot find module 'extract-text-webpack-plugin'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/khoa/web/mui/node_modules/preact-cli/lib/lib/webpack/webpack-base-config.js:13:33)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/khoa/web/mui/node_modules/preact-cli/lib/lib/webpack/webpack-client-config.js:39:26)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/khoa/web/mui/node_modules/preact-cli/lib/lib/webpack/run-webpack.js:27:28)
    at Module._compile (module.js:569:30)

Reproduce:

  • Init new project preact create test && cd $_
  • npm start

P/s:

This only happens with [email protected]. For some reason, node can't resolve it

❯ npm ls extract-text-webpack-plugin
[email protected] /home/khoa/web/mui
└─┬ [email protected]
  └─┬ @webpack-blocks/[email protected]
    └── [email protected] 

My rule of thumb is if you use it, you must install it first. Thoughts @developit @lukeed ?

@reznord
Copy link
Member

reznord commented Jul 11, 2017

@thangngoc89 can't able to reproduce.

Might be because during installation of node_modules, something got missed.

Can you try removing node_modules and reinstalling them?

@thangngoc89
Copy link
Collaborator Author

@reznord I reproduced this twice.

@thangngoc89
Copy link
Collaborator Author

thangngoc89 commented Jul 11, 2017

Apparently, npm installed it but node can't resolve it

❯ npm ls extract-text-webpack-plugin
[email protected] /home/khoa/web/mui
└─┬ [email protected]
  └─┬ @webpack-blocks/[email protected]
    └── [email protected] 

And yes, I removed node_moduels and re-install it twice

@thangngoc89 thangngoc89 changed the title Error: Cannot find module 'extract-text-webpack-plugin' Error: Cannot find module 'extract-text-webpack-plugin' with [email protected] Jul 11, 2017
@reznord
Copy link
Member

reznord commented Jul 11, 2017

Looks like an npm issue for me. In 5.0.1, I am not able to reproduce this.

@slaskis
Copy link

slaskis commented Jul 11, 2017

Same issue if you try to use npx to create a new app:

$ npx preact-cli create test
npx: installed 1 in 12.986s
Cannot find module 'extract-text-webpack-plugin'

Which otherwise would be an awesome way to use preact-cli.

@thangngoc89
Copy link
Collaborator Author

@slaskis Actually it's how I discovered this bug. :D . Wanted to try out npx on [email protected]

@developit
Copy link
Member

sounds like an npm dedupe issue

@thangngoc89
Copy link
Collaborator Author

@developit My point still stand. We are importing extract-text-webpack-plugin directly in the code, so we should install directly

@reznord
Copy link
Member

reznord commented Jul 11, 2017

I agree with @thangngoc89. Webpack 3 has separated the plugin totally. I guess it is better to install it separately.

@thangngoc89
Copy link
Collaborator Author

thangngoc89 commented Jul 11, 2017

@reznord Could you make a PR to replace @webpack-blocks/extract-text2 with extra-text-webpack-plugin directly? We dont use @webpack-blocks/extract-text2 directly anymore.

@reznord
Copy link
Member

reznord commented Jul 11, 2017

@thangngoc89 ayeee... PR enroute. 😄

@reznord
Copy link
Member

reznord commented Jul 11, 2017

@thangngoc89 we are not using that anywhere as of now.

Edit: Oops, didn't see that. Got it. Gonna push it soon.

@thangngoc89
Copy link
Collaborator Author

@reznord I'm not follow. We're using extract-text-webpack-plugin but not webpack-block/extract-text2.

@Connorelsea
Copy link

Connorelsea commented Jul 12, 2017

Got this error using the latest NPM, was able to "fix" by simply using yarn instead.

For anyone stuck: yarn global add preact-cli

Then yarn and yarn start in the created project.

@developit
Copy link
Member

^^ Ahh interesting, I didn't realize we had moved off of webpack-blocks for this already. Definitely best to add it as a dependency then.

@fokusferit
Copy link

We also got to the same problem. The current issue rises when we don't install preact-cli globally and use it from the node_modules.

@anantoghosh
Copy link
Contributor

@reznord any pr for the master branch? It has been fixed in the webpack3 branch 79fb4fa

@reznord
Copy link
Member

reznord commented Aug 10, 2017

@anantoghosh webpack3 will be available in the next version (which might take sometime) because there are a bunch of things which we are planning for the next release

@thangngoc89
Copy link
Collaborator Author

@anantoghosh if you can send a PR to back port that change to preact-cli, I'll be happy to merge it

@reznord
Copy link
Member

reznord commented Aug 10, 2017

I wouldn't do that! Since it is already changed in webpack branch, that might just lead us to conflicts while merging it.

@thangngoc89
Copy link
Collaborator Author

@reznord this is a bug and we should fix it asap. Since webpack 3 will be a major change and the release day is pretty much unclear. I would recommend back port the fix and release a new version

@reznord
Copy link
Member

reznord commented Aug 10, 2017

Well, in that case it is fine. (:

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

No branches or pull requests

7 participants