-
-
Notifications
You must be signed in to change notification settings - Fork 27k
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
"TypeError: MiniCssExtractPlugin is not a constructor" in fresh CRA installation #11930
Comments
Same Failing fresh install Build fails |
Same, getting the same errors. I have changed my nvm to 16 and even lower than that, tried yarn, cleared out the cache, etc. |
I think it's because of an update to
in |
I tried that, to no avail; the same issue persists. |
@Aninstance did you run |
npm i -D --save-exact [email protected] or if you're using "overrides": {
"mini-css-extract-plugin": "2.4.5"
} to your |
I'm using npm, however have multiple other resolutions in the list, which are installed running |
I've tried the resolutions method (npm), and it usually works in every situation. But not here. I had to take a different approach for our deployments to succeed.
|
Pinning the mini css extract version worked for me:
Edit: It does seem like adding
|
Absolutely solved it for now, thank you. (Was having a mental breakdown during) |
I changed import in
UPDATE (27 Jan 2022): Now it seems that it has already been fixed and this import looks like this: |
I'm actually still having this issue due to the fact that we're not saving lockfiles. It worked locally but when building on our CI server it was still broken. |
I ended up simply pinning the version number in my package.json dependences, which finally built correctly, i.e. |
See details on the bug here: this issue: facebook/create-react-app#11930 Revert this change when the bug is resolved.
This solved it, thank you so much! |
- pin mini-css-extract-plugin as suggested facebook/create-react-app#11930
Didn't work for 😥. |
In my case, the simplest solution was simply to add this to the dependencies in your
But be sure to make a note to keep an eye out for when the issue is fixed upstream, then remove that line, otherwise that version will be pinned forevermore and you could run into issues later on. |
Am still getting the same issue, i tried to do all the mentioned solutions but still get the same issue. |
Are you using NPM? If so, have you cleaned cache & deleted your package-lock.json & node_modules prior to attempted install? If you are using NPM (and bash), try this:
|
###try running
|
Install React Scripts again<npm install react-scripts --force |
don't forget to remove 'node_modules' |
It worked, thank iu <3 |
Due to some challenges with the new version: - facebook/create-react-app#11756 - https://stackoverflow.com/questions/70429654/webpack-5-errors-cannot-resolve-crypto-http-and-https-in-reactjs-proje - facebook/create-react-app#11930
Similar issue as in: - facebook/create-react-app#11930
There is no need to manually update package-lock.json, as long as you're on react-scripts v5 all you need to do is run |
For me I just needed to install mini-css-extract-plugin to get the build working. |
Also, unpin specific version of mini-css-extract-plugin. The issue that was causing builds to fail has been fixed. See: facebook/create-react-app#11930
console.log |
Describe the bug
CRA build fails with
Did you try recovering your dependencies?
Clearing
package-lock.json
andnode_modules
did not help at all.Which terms did you search for in User Guide?
I have been searching for this error for a few hours but I can't find it anywhere. It shouldn't be happening on a fresh installation.
Environment
Steps to reproduce
Issue can be replicated easily via
Expected behavior
I expected
npm run build
to work without errors.Actual behavior
It produced the error
TypeError: MiniCssExtractPlugin is not a constructor
instead.Reproducible demo
The text was updated successfully, but these errors were encountered: