Error encountered in Webpack-cli: Attempting to convert an undefined or null value to an object

Trying to execute yarn build

Encountering the following error:

    yarn run v1.22.4
$ webpack --progress --config resources/assets/build/webpack.config.js


  \wp-content\themes\portfolio\node_modules\webpack-cli\bin\cli.js:93
                                    throw err;
                                    ^

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at mergeTo (\wp-content\themes\portfolio\node_modules\webpack-merge\dist\merge-with.js:30:24)
    at \wp-content\themes\portfolio\node_modules\webpack-merge\dist\merge-with.js:23:15
    at Array.forEach (<anonymous>)
    at Object.mergeWith [as default] (\wp-content\themes\portfolio\node_modules\webpack-merge\dist\merge-with.js:22:10)
    at mergeWithOptions (\wp-content\themes\portfolio\node_modules\webpack-merge\dist\index.js:71:39)

In my config.js file, I am importing webpack-cli

const { merge } = require('webpack-merge');

Version information for webpack packages:

 "webpack": "~4.44.2",
"webpack-assets-manifest": "^3.1.1",
"webpack-cli": "^3.3.12",
"webpack-merge": "~5.1.4",

This issue started occurring after updating the webpack-cli version.

Answer №1

The essence of the message is that it is expecting an object of a certain type, but it is receiving null instead. This could be because the object has been set to null intentionally or by mistake. The code expects an object of a specific type, but it encounters either undefined or null. It's possible that the object in question is actually an array and it lacks the necessary member due to its short length or the array simply doesn't exist. The recent update of the webpack CLI version may have prompted the need to update other components for proper functionality, which might have been overlooked, resulting in missing code essential for initializing the object or array.

This error can be traced back to the file: \wp-content\themes\portfolio\node_modules\webpack-cli\bin\cli.js line 93. Reviewing this line may offer insight into the issue at hand.

It would also be beneficial to examine the following files mentioned: TypeError: Cannot convert undefined or null to object at Function.keys () at mergeTo (\wp-content\themes\portfolio\node_modules\webpack-merge\dist\merge-with.js:30:24) at \wp-content\themes\portfolio\node_modules\webpack-merge\dist\merge-with.js:23:15 at Array.forEach () at Object.mergeWith [as default] (\wp-content\themes\portfolio\node_modules\webpack-merge\dist\merge-with.js:22:10) at mergeWithOptions (\wp-content\themes\portfolio\node_modules\webpack-merge\dist\index.js:71:39)

Perhaps there is an issue with merging incompatible webpack CLI versions together.

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

What are the steps to accessing the scene, renderer, and camera objects in Forge Viewer v6 using TypeScript?

In the past, I could utilize code such as this: var container = viewer.canvas.parentElement; var renderer = viewer.impl.renderer(); var scene = viewer.impl.scene; To access Three.js objects in Forge Viewer. With version 6, how can I achieve the same usin ...

An error is triggered when attempting to target multiple element Id's in Javascript and one of them cannot be located

I have encountered an issue when trying to target multiple IDs with JavaScript in order to disable input fields associated with them. The script I am using seems straightforward, but I noticed that on pages where the middle element is missing, the third on ...

I am experiencing issues with create-react-app not functioning on my computer any longer

My computer is having issues with create-react-app It seems like a template was not provided, possibly due to using an outdated version of create-react-app. Global installs of create-react-app are no longer supported. To fix this, try running npm uninsta ...

Build a custom form for the purpose of exporting an HTML file

I am in search of a way to provide my users with various "feature" choices that will assist them in creating an HTML file for an email. I already have the code ready for each feature, but I want users to be able to select a feature (such as Hero Image Head ...

Angular failing to update $scope variable within controller

I need to implement a directive that allows file uploading directly to the browser angular.module('angularPrototypeApp') .directive('upload', ['$parse', function ($parse) { return { restrict: 'A', scope: fal ...

Save the output to the server's file

Looking for a straightforward way to output the results of a json query in a more structured format. I currently have a file that fetches statistics from a json query and displays it using document.write. Now, I need these results to be stored in a csv or ...

Establish a single route for executing two different statements in MSSQL: one for updating and the other for inserting data into the MS-SQL

I have a Node application where I currently insert data into one table, but now I also need to insert it into another table. The issue is that I am unsure how to execute a second promise for this task. var query = "first SQL query..."; var query2 = "new ...

What is the best way to fetch images from a JSON object in a React application?

I have been trying to load images from an array of objects in React, but I keep encountering a "module not found" error. This issue has been frustrating me for the past couple of days. Can someone please help me troubleshoot this problem or provide some su ...

The .removeAttr('checked') method fails to function as expected

I am currently using CodeIgniter. Check out this example of my code. Please fill the textbox and check the checkbox next to it, then click on the "add" link. You will notice that it does not work as expected..removeAttr('checked') newDiv.find(&a ...

Exclude cascading classes in CSS

Help Needed with HTML Lists! <li>A.</li> <li><a href="#">B.</a></li> <li><a class=tr href="#">C.</a></li> <li class=tr>D.</li> <li class=notr>E.</li> I am trying to selec ...

What is the best way to define a constant within a map function?

I have a VueJs computed function called linhas() that populates the rows of my DataTable. I am struggling with opening up this function to assign a value to "this.grupo", so that I can avoid using it the same way as I do with "this.maquinas". As a beginner ...

Tips on retrieving Bootstrap selectpicker value by using loops in Jquery

I am attempting to perform a basic validation using jQuery, where I need to iterate through all elements to check for the existence of values. The validation script is working well except for the jQuery selectpicker functionality. Here's what I have t ...

Is there a way to maintain data from a database when making another GET request with a different query string in React (Next.js)?

English isn't my first language, so please bear with me! Please review my code first: export default function DriveFolder() { const [clickFolderPk, setClickFolderPk] = useState(1); const viewFolder = async () => { const url = `/ ...

Data from HTML not being transferred by Angular Forms

I am facing an issue with transferring input data from HTML's <select> element to Angular Forms. Let's take a look at my code first. File Name: home-page.component.html <form [formGroup]="rForm" (ngSubmit)="addPaste(rForm.value)"> ...

When utilizing drag and drop in HTML5, the items.webkitGetAsEntry() method is not available

Hey there, I am attempting to drag and drop files into my file system using Chrome, but I encountered the following error in the console: var dnd = new DnDFileController('body', function(files, e) { var items = e.dataTransfer.items; for ...

Sass compilation issue with node and gulp resulting in an error

click here for image preview I encountered issues with Foundation while attempting to integrate it with gulp. Any suggestions or guidance would be greatly appreciated. I attempted re-running sudo npm install and gulp without success. The Framework I am ...

This error message has been thrown on line 173 of the events.js file due to an unhandled error event

I am encountering an issue with running the "npm start" command. The error message I receive is as follows: node -v : v12.0.0 npm -v : 6.9.0 I have attempted to reinstall all the necessary software, and even adjusted the port number in an attempt to troub ...

Encountering an error while attempting to launch an AngularJS application on Node.js? Let's

Currently, I am in the process of learning Angular. Whenever I attempt to run my code, an error message pops up: > <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1f7a737a7c6b6d70715f2b312f3115">[email protected]< ...

States are consistently maintained in React and do not impact the rendering process

I am keeping track of a state value by declaring it like this: const [count, setCount] = useState(0); To increment the count: const incrementCount = () => { setCount(count + 1); } I use this function in a loop to iterate through an array, exec ...

jQuery validation does not work properly when using .element(element) in a custom method

I am struggling with a custom rule that is supposed to check dependencies by validating other inputs it relies on. However, when I implement this validation, it seems like all other validations are being ignored. Here is my custom validation rule: jQuery ...