4

Hi everyone.

I've got an error from npm everytime I try to install pacakges. I got this error :

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 know there's already a topic about my problem but I really tried every solution I could find and not a single one works. I uninstall and reinstall node multiple times, cleaned my cache but I can do nothing !

Here's my package.json

{
  "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": {}
}

Can somebody help me, I don't know what to do, I cannot install a single package ...

Thanks !

Pliboux
  • 109
  • 1
  • 1
  • 8
  • Why do you have `npm` as dependency in the project? – Anatoly Nov 06 '20 at 19:22
  • Honestly, I don't know but if I delete this package from my package.json, I still got the error. – Pliboux Nov 06 '20 at 19:26
  • Does this answer your question? [npm ERR cb() never called](https://stackoverflow.com/questions/15393821/npm-err-cb-never-called) – Olian04 Nov 06 '20 at 19:42
  • Thanks for the link but this is the very first post I saw and I did everything in this one and it doesn't work, I don't know where the error come from .. – Pliboux Nov 06 '20 at 19:47
  • I also have a lot a warning before : tar EPERM: operation not permitted , open 'C:\Users\prevo\Desktop\coding_projects\BarkBot\node_modules\.staging\npm-38d46a69\node_modules\retry\equation.gif' and I don't know why I have this kind of thing.. – Pliboux Nov 06 '20 at 19:48

5 Answers5

5

Just run:

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

The command lines are self explanatory. One needs to clear (clean) the cache and upgrade npm. After which, it should work.

azbarcea
  • 3,323
  • 1
  • 20
  • 25
2

After spending hours on many recommendations that did not work. I finally got npx create-react-app running by doing the following:

  1. Uninstall npm by running the following code at your command prompt:

    npm uninstall -g create-react-app
    
  2. Increase timeout by changing/adding this line in your .npmrc file:

    timeout=60000;
    prefer-offline=true;
    

    Your .npmrc file can be found in C:\Program Files\nodejs\node_modules\npm (windows)

    Then RESTART your PC

  3. Disable your antivirus (as @Antoine said)

  4. Run the following at the command prompt

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

    where my-app is the name of your project

NOTE: I am not using any proxy.

RobC
  • 22,977
  • 20
  • 73
  • 80
Eldee
  • 38
  • 6
0

Ok, I manage to solve my problem by disabling my Antivirus, I don't know why ...

Pliboux
  • 109
  • 1
  • 1
  • 8
0

On our local machine it worked, on Azure Pipelines the mentioned error showed up.

Our solution: Add the 'npmAuthenticate' task before the npm ci command.

> official description of the task

hogan
  • 1,434
  • 1
  • 15
  • 32
0

I had the similar problem in internal company project. I was able to reproduce the error and solve it by running npm install --no-package-lock but while running in the jenkins pipeline, the error was not solved. I managed to solve it by disabling the proxies as below:

 sh """
        proxy='' \
        https_proxy='' \
        http_proxy='' \
        npm install
        npm run test
    """
Kushal Atreya
  • 183
  • 2
  • 7