How should I proceed if I encounter an npm error stating that cb() was never called?

Hey everyone.

I keep encountering an issue with npm whenever I attempt to install packages. I am receiving the following error message:

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

I have searched for solutions high and low, but none seem to work. I have uninstalled and reinstalled Node multiple times, cleared my cache, but nothing seems to fix it!

Here's a glimpse of my package.json file:

{
  "name": "XXXXXXXXXXX",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node index.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "axios": "^0.21.0",
    "discord.js": "^12.4.0",
    "howlongtobeat": "^1.2.1",
    "npm": "^6.14.8"
  },
  "devDependencies": {}
}

If anyone has any insights or suggestions on how to resolve this issue, please let me know. I'm at my wit's end trying to install even a single package ...

Thank you in advance!

Answer №1

To resolve the issue, simply execute these commands:

npm cache clean --force
npm cache verify
npm install --global npm

The instructions in the command lines are quite clear. By clearing the cache and updating the npm package, the problem should be fixed.

Answer №2

After struggling with various suggestions that proved to be ineffective, I finally managed to successfully run npx create-react-app by following these steps:

  1. To begin, uninstall npm by executing the following command in your terminal:

    npm uninstall -g create-react-app
    
  2. Next, adjust the timeout settings by modifying or adding this line in your .npmrc file:

    timeout=60000;
    prefer-offline=true;
    

    You can locate your .npmrc file at

    C:\Program Files\nodejs\node_modules\npm
    (for Windows)

    Remember to RESTART your computer

  3. Temporarily disable your antivirus software (as advised by @Antoine)

  4. Proceed to execute the following commands in your terminal:

    npm clean cache --force
    npm install create-react-app
    npx create-react-app my-app
    

    Replace my-app with the desired name of your project

NOTE: It is important to note that I am not utilizing any proxy.

Answer №3

After some troubleshooting, I was able to resolve the issue by temporarily disabling my Antivirus software. The reason behind this workaround remains unclear to me...

Answer №4

While our code ran smoothly on our local machine, we encountered an error when running it on Azure Pipelines.

To resolve this issue: We included the 'npmAuthenticate' task before executing the npm ci command.

> Check out the official description of the task

Answer №5

When I encountered a similar issue on an internal project, I was able to identify and address the problem by using npm install --no-package-lock. However, when I attempted to run the same commands in our jenkins pipeline, the error persisted. I eventually resolved the issue by disabling all proxies as outlined below:

 sh """
        proxy='' \
        https_proxy='' \
        http_proxy='' \
        npm install
        npm run test
    """

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

Retrieve information from a sensor within an Express server and display it on the user interface

Looking for suggestions on resolving a challenge: I have a Node.js module that retrieves data from a sensor, and I am interested in incorporating a UI element to showcase the sensor data (either in real-time or pseudo-realtime). Is there a way to establ ...

Error: JSDOM - The document variable has not been declared

After creating a basic webpage that displays a single message, I decided to experiment with JSDOM and encountered an error. Despite researching online examples and Stack Overflow questions, I have struggled to resolve even the most straightforward scenario ...

Trouble with Callback firing in Select2's 'Infinite Scroll with Remote Data' feature

After reviewing the tutorial on the Select2 project page, I am implementing a feature to load additional records as the user scrolls to the end of the results. <script> $(document).ready(function() { $('#style_full_name').select2({ ...

Creating a menu with items and listeners from a kmllayer - a step-by-step guide

Currently, I am working with a map that includes a kmllayer. This layer has been added using the following code: ctaLayer = new google.maps.KmlLayer('http://www.npd.no/engelsk/cwi/pbl/en/aFactGlobe/disc/ActivityStatus_Producing_labels.kml'); ...

Having a ReactJs issue: When trying to run npm start, it's not working. I attempted to fix it by running "npm cache clean --force" but still no luck. Now I

Encountered the following error : [email protected] start /home/gaurav/Desktop/Django + React/Saurav Hardware/saurav_hardware/my-app react-scripts start sh: 1: react-scripts: not found npm ERR! code ELIFECYCLE ...

JavaScript Date behaving oddly

While working with Javascript, I encountered a puzzling issue involving the Date object. date1 = new Date(1970, 1, 1); date2 = new Date("1970-01-01T13:00:00.000Z"); console.log(date1.getYear()); //70 console.log(date1.getMonth()); //1 console.log(date1.g ...

Error received on Node.js controller when calling Jquery getJSON from Ajax form

I have a Node.js / Sails.js application with a client-side form that submits to a Controller using jQuery ajax: $(function () { $("form").submit(function (e) { e.preventDefault(); var form = $(this); $.ajax({ url: ...

Exploring the integration of Stripe Checkout with React and Express.js

Seeking assistance with integrating Stripe Checkout into my React application. I need to create a route in my nodejs/express server that will provide the session id required for setting up Stripe Checkout on the front end. The aim is to redirect users to s ...

The current registry configuration does not provide support for audit requests when running npm audit

I am facing an issue with one of my dependencies that is in the form of "protobufjs": "git+https://github.com/danieldanielecki/protobufjs-angularfire.git#master". I installed it using npm install --save https://github.com/danieldanielecki/protobufjs-angula ...

What is the method to access nested JSON data returned from the Angular JS $http service?

Here is the main JSON file I am using { "chartType" : ["column", "column", "pie"], "chartTitle": ["Number of teams", "Number of consumable items","Number of employees in charge"], "yAxisTitle": ["Teams", "Consumables", "Employees"], "seriesName": ...

Struggling with implementing the use of XMLHttpRequest to transfer a blob data from MySQL to JavaScript

I have a blob stored in my local WAMP64/MySQL server that I need to retrieve and pass to an HTML file using XMLHttpRequest. I know I should set responseType="blob", but I'm not sure how to transfer the blob from PHP to JavaScript in my HTML file. Any ...

Looking for subsequence in dropdown choices with no assigned values

I need assistance with searching for a specific substring within text that is fetched from options generated by MySQL. How can I retrieve the selected option's text value in order to search for my desired substring? $(document).ready(function() { ...

JavaScript: Populating an Array with Image URLs Using a Loop

My image gallery project has hit a roadblock and my JavaScript skills are not up to par. Maybe it's time to brush up on the basics with a good book from the library. Here's what I want to achieve: 1. Create an array of URL's for each imag ...

Is there a way to serialize a dynamically loaded element with jQuery?

So here's the situation: I have a list of tags that needs to be updated using an ajax call. First, I clear out the <ul> that holds the tags. Then, with the response from the ajax call, I populate the <ul> with new <li> elements re ...

If you scroll quickly, watch out for the flickering of the fadeIn and fadeOut

I have a script that fades in an element once the user scrolls more than 145px from the top of the page. $(window).scroll(function(){ if ($(this).scrollTop() > 145) { $('#fademenu').fadeIn(); } else { $('#fademenu').fadeOut(); } } ...

Utilizing Angular partials within specific views with the assistance of ui-router

I am currently working on developing a MEAN application and facing some challenges while handling ui-router. Within my index.html file, I have set up the template for the entire website including a header, sidebar, and content area where I have placed < ...

Switch between different classes with JavaScript

Here is the code that I am working with: This is the HTML code: <div class="normal"> <p>This is Paragraph 1</p> <p>This is Paragraph 2</p> <p>This is Paragraph 3</p> <p>This is Paragraph 4&l ...

Is there a way for me to attach a link to a picture displayed in a lightbox that directs to an external ".html" file?

I have a platform where users can view images in a gallery and when they click on an image, it opens up in a lightbox. I am trying to add a feature where the opened image can be clicked again to redirect the user to an external page. I attempted to nest t ...

Update Button Visibility Based on State Change in ReactJS

Currently, I'm utilizing a Material UI button within my React application. Despite changing the state, the button remains visible on the screen. Here's the relevant code snippet: function MainPage() { const state = useSelector(state => sta ...

Tips for saving a document in a table without using the _id field

I want to save the employee object without the _id attribute, just the "employee" attribute as shown below: "employee" :[ { "name" : "leila", "idemployee" : ObjectId("59319505efa50b137477a1f4"), ...