encountering difficulty while attempting to use the npm run build command

Whenever I attempt to compile my react project using npm run build, an error appears. I also tried using yarn build but encountered a similar error. Below is the snippet of code causing the issue:

TypeError: MiniCssExtractPlugin is not a constructor
at module.exports (A:\projects\Own Projects\project-listing-site\node_modules\react-scripts\config\webpack.config.js:664:9)
at Object.<anonymous> (A:\projects\Own Projects\project-listing-site\node_modules\react-scripts\scripts\build.js:58:16)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] build: react-scripts build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] build 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! C:\Users\user\AppData\Roaming\npm-cache_logs\2022-01-15T11_10_02_360Z-debug.log

Answer №1

Consider updating the version of the mini-css-extract-plugin. For yarn users, modify the package.json to include this and then execute yarn install:

  "resolutions": {
    "mini-css-extract-plugin": "2.4.5"
  },

If you are using npm, use the following command:

npm i -D --save-exact <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1875717671357b6b6b357d606c6a797b6c3568746d7f7176582a362c362d">[email protected]</a>

If these solutions do not resolve your issue, refer to other responses on this github thread

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

A powerful combination of Node.js, Angular, and Jade on the client side, complement

Can anyone offer advice or examples on how to structure an app like this effectively? Client (client.company.com) Node.js Angular Jade ExpressJS Server (private) (server.company.com) node.js "rest" api (express) The API is currently private ...

Is it possible for npm to assist in determining the appropriate version of Primeng that is compatible with Angular 16 dependencies

While trying to add primeng to my project, I ran into an error message: npm i primeng npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: <a href="/cdn-cgi/l/email-protection" class="__cf_email__ ...

Error encountered: NPM cannot locate mime-db package

After encountering an issue with npm, I was forced to reinstall Nodejs on my Macbook. Despite multiple attempts, I kept receiving the same error message: $ npm Error: Cannot find module 'mime-db' at Function.Module._resolveFilename (module. ...

Node.js promises are often throwing Unhandled Promise Rejection errors, but it appears that they are being managed correctly

Despite my efforts to handle all cases, I am encountering an UNhandledPromiseRejection error in my code. The issue seems to arise in the flow from profileRoutes to Controller to Utils. Within profileRoutes.js router.get('/:username', async (r, s ...

express-flash-notification displays the following error message: "No default engine was specified and no extension was provided."

Recently, I started working with node.js and using MEAN stack for my project. In the footer of my project, I have an option to "Subscribe email". Due to constraints in the architecture, I am unable to utilize Angular for displaying flash messages as I don& ...

Encountering challenges with MongoDB's Bulk API as I attempt to transfer my JSON data to MongoDB through NodeJS

Having trouble uploading my json file to MongoDB in a sequential manner using the Bulk API. I keep getting an error message stating "TypeError: bulk.insert is not a function". I've checked the documentation and my syntax seems fine. Any suggestions o ...

Problem: values.map is not a function (What causes this error to occur?)

I have a task to fetch details from the database using an ID and display them in a table. However, initially, I just want to display them on the browser without any formatting. When I try to do this, I encounter an error message saying 'values.map is ...

Javascript is handling the JSON Request flawlessly, however, when using Nodejs, an error is encountered with a status

I'm trying to fetch a simple JSON File in NodeJS. Using Javascript and jQuery, it functions perfectly: $(document).ready(function() { $.getJSON('https://www.younow.com/php/api/broadcast/info/curId=0/user=Peter', function(json) { if ...

Cloud9 encounters NPM update issue with error message 'npm log' module cannot be found

Hey there! This morning I kicked off a brand new project in Cloud9, and encountered an update prompt when running "npm init" which I complied with. After what seemed like a successful installation, I proceeded to run "npm install" for some packages, only ...

Guide on programmatically setting up nvm and utilizing npm

Hey there! I've been working on some scripts to customize my shell environment, and everything is going great except for nvm. Here's a snippet from my script: #!/bin/zsh set -Eeuo pipefail echo 'Installing nvm' touch $HOME/.zshrc curl ...

Encountered an issue stating "Voucher totals do not match!" while trying to import data into Tally using Node.js

My goal is to transfer an xlsx file into tally. I have successfully converted the xlsx file to XML using node js. Now, my next step is attempting to upload the converted XML data to tally with node js. Below is the XML code that I am working with. <ENVE ...

Having trouble with the express message! I can't seem to access the template I created

I am looking to receive a notification similar to an alert, as described in this link: https://github.com/visionmedia/express-messages By default, I receive something like this https://i.stack.imgur.com/9XlA9.png If I use a template, I do not get any out ...

What is the process for removing a registered user from Realm Object Server with the use of the Javascript library?

I have been searching online for a solution, but I haven't been able to find an answer. I am attempting to remove a user from ROS, however, I cannot locate a designated API for this task. The version of my realm-js is 1.10.3. If this feature does not ...

What is the best way to retrieve variable data from a Node.js function in an external context?

This Node.js function is designed to retrieve data from Analytics: function getDataFromGA(Dimension, Metric, StartDate, EndDate, MaxResults) { var fs = require('fs'), crypto = require('crypto'), request = require('request& ...

Is it possible to authenticate a user in Firebase using Node.js without utilizing the client side?

Can I access Firebase client functions like signInWithEmailAndPassword in the Firebase SDK on the server side? Although SDKs are typically used for servers and clients use JavaScript, I need a non-JavaScript solution on the client side. I have set up the ...

Maintaining personalized variable values for individual connected clients in Node.js: What's the best approach?

I have recently started working with Node.js and I am using Visual Studio 2015 with the Basic Node.js Express 4 app template. After setting some values through a post request from the client, I noticed that when I open another tab and send another post re ...

Requests from external sources are being overlooked by Node.js running on a virtual machine

This is my first time working with nodejs and express, so please bear with me if this question seems basic. I recently set up nodejs and express on my Debian virtual machine and created a hello-world application. To run it, I used the command: DEBUG=myap ...

Executing a callback in Javascript from within a NAN AsyncWorker in a NodeJS Addon

Exploring the idea of calling a Node.js callback from within my asynchronous addon function has been an interesting journey. I found inspiration in both synchronous (here) and asynchronous (here) examples to guide me. However, encountering a Segmentation ...

Node Module log statements not showing up in console

I am just starting out with Node JS. I recently installed a module using npm install '<module_name>. The installation process went smoothly without any errors. Now, I wanted to debug the module so I added some console.log('some text') ...

How to eliminate an item from an array in MongoDB using mongoose

In my NodeJS application, I have created a MongoDB model using mongoose that looks like this: const mongoose = require("mongoose"); const Schema = mongoose.Schema; const userSchema = new Schema({ name: { type: String, required: true ...