npm ERR! cb() never called - node.js

I was trying to download expo cli and I got error:-
C:\WINDOWS\system32>npm i -g expo-cli
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://github.com/npm/cli/issues>
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HP\AppData\Local\npm-cache\_logs\2021-03-03T14_02_14_809Z-debug.log
I also used npm cache clean --force.
But it didn't work too😥
C:\WINDOWS\system32>npm -v
7.6.0
C:\WINDOWS\system32>node -v
v14.16.0
Please help me......
And after doing npm i -g npm it worked!!!!!!
But when I tried to install or download any packages then error:
E:\React-native\practice>npm i react-native-elements
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://github.com/npm/cli/issues>
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HP\AppData\Local\npm-cache\_logs\2021-03-04T05_03_20_067Z-debug.log
So what is wrong going on?

If you are using npm version 5 or above:
Try following command:
$ sudo npm cache verify
OR
$ sudo npm cache clean --force

I've had the same problem, and was able to fix it by adding the flag --legacy-peer-deps to the installation command. For instance:
npm i --legacy-peer-deps package-name

Run npm install -g npm & npm cache clean

I had the same problem and solved it with checking my proxxy settings in C:\Users\username.npmrc
here are the settings for the proxy.
proxy=...
https-proxy=...
strict-ssl=false
registry=...
You can set these things through npm with the following:
npm config set proxy ...
npm config set https-proxy ...
npm config set strict-ssl false
npm config set registry ...
Maybe you have to remove proxy and https-proxy to make it work.

I had the same problem in all npm package that I tried to download, and solved just running this command in my Windows CMD.
npm set strict-ssl true

You can try to force clean the npm cache
npm cache clean --force

I did the following steps:
delete node_modules
remove package-lock.json
run npm cache clean --force
run npm install --force
npm install --force was the key to success, because even after doing 1-2 steps, normal npm install resulted in same problem

Related

npm install -g react-native-cli

Hello i'm trying to instal react native but on running npm install -g react-native-cli it brings the following error on Command Prompt.
npm ERR! code EINVAL
npm ERR! path C:\WINDOWS\system32\'C:\Users\User\AppData\Roaming\npm
npm ERR! Illegal characters in path.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Local\npm-cache\_logs\2021-02-06T17_33_30_954Z-debug.log
try to clean cache
npm cache clean --force
then run
npm install -g react-native-cli
Or
delete your nodemodules folder
and then run
npm install -g react-native-cli
I also got this error:
npm ERR! EINVAL: invalid argument, utime
And was solved the issue with message:
By doing the following steps:
npm install -g npm#latest
cd your_project_directory
rmdir /s /q node_modules
npm install
That, basically upgrade the node package, then refresh the project's packages. Hope this brings down your error!

npm install always gives 'Your cache folder contains root-owned files, due to a bug in npm previous versions of npm which has since been addressed.'

I am currently using Ubuntu 18.04.4 and I am trying to install something using npm install but it always gives the error below. I tried other aliases as well (npm i, npm add) but the error persists.
npm install
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path /home/dell/.npm/_cacache/content-v2/sha512/14/21/2143fe2b135cd8bfdad85c9c3f9ac46ab279a58dee631cfea1b9678167bd388d44f2d36739019c96ba3a4c4756b1ea6570f4dc8931fb8ad8230359521f80
npm ERR! errno -1
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1001:1001 "/home/dell/.npm"
npm ERR! A complete log of this run can be found in:
npm ERR! /home/dell/.npm/_logs/2020-07-30T17_16_58_257Z-debug.log
When I run the sudo chown -R 1001:1001 "/home/dell/.npm" command, it does nothing, and the error remains when I run npm install again. I have also searched StackOverflow and other platforms for the answer, but no solution seems to solve this problem.
P.S: My node version is 12.18.3 and npm version is 6.14.6.
If someone can help me resolve this, I would really appreciate it!
I had problem with create-react-app. Solve it using yarn.
yarn global remove create-react-app
then
yarn global add create-react-app
and
create-react-app MyApp

npm ERR! Refusing to delete when Install react-native

I Have a Problem about NPM, I want to instal npm react-native with command npm install -g react-native-cli on cmd,
But, an error suddenly appeared like this :
npm ERR! path C:\Users\Xeon\AppData\Roaming\npm\react-native.cmd
npm ERR! code EEXIST
npm ERR! Refusing to delete C:\Users\Xeon\AppData\Roaming\npm\react-native.cmd: is outside C:\Users\Xeon\AppData\Roaming\npm\node_modules\react-native-cli and not a link
npm ERR! File exists: C:\Users\Xeon\AppData\Roaming\npm\react-native.cmd
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Xeon\AppData\Roaming\npm-cache\_logs\2020-02-12T03_00_40_156Z-debug.log
I don't know why this error appears, hopefully I can find a solution here.
thank you
Check your npm/node version, make sure they install correctly
currently there's no need to install react-native-cli for RN 0.61
you should try
npx react-native init ProjectName
or just using expo instead
npm install -g expo-cli
expo init AwesomeProject
Lastly, you should read the Official Doc for more details.

Angular8 node js and npm installation problems

I'm learning angular js. For this I've install nodejs and git. And I've run following command on CMD:
npm install -g #angular/cli#latest
After some time following error occurred
npm WARN rollback Rolling back #schematics/angular#8.3.21 failed (this is
probably harmless): EPERM: operation not permitted, lstat 'C:\Users\User
Name\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\#schematics'
npm ERR! code EEXIST
npm ERR! path C:\Users\User
Name\AppData\Roaming\npm\node_modules\#angular\cli\bin\ng
npm ERR! dest C:\Users\User Name\AppData\Roaming\npm\ng.ps1
npm ERR! EEXIST: file already exists, cmd shim 'C:\Users\Chaitanya
Kulkarni\AppData\Roaming\npm\node_modules\#angular\cli\bin\ng' ->
'C:\Users\Chaitanya Kulkarni\AppData\Roaming\npm\ng.ps1'
npm ERR! File exists: C:\Users\User Name\AppData\Roaming\npm\ng.ps1
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User Name\AppData\Roaming\npm-cache\_logs\2020-01-
04T12_12_30_922Z-debug.log
Can you please explain what is that error and how I could solve this. I am using Window 10.
Perform following steps:
Completely uninstall angular-cli from your machine
npm uninstall -g angular-cli
Clean npm cache
npm cache clean --force
Reinstall angular cli,
npm i #angular/cli#latest -g
Run this commands and manually delete the exist files if does not work.
Completely uninstall angular-cli from your machine
npm uninstall -g angular-cli
Clean npm cache
npm cache clean --force
Reinstall angular cli,
npm i #angular/cli#latest -g
Delete this file going to the location.
C:\Users\Chaitanya Kulkarni\AppData\Roaming\npm\ng.ps1
You can try opening the Command Prompt with Administrator privileges and then run the command.
Try to run following command in terminal
npm install -g #angular/cli#latest --force
In the terminal navigate to the following path:
C:\Users\UserName\AppData\Roaming\npm\node_modules
and delete angular file and reinstall cli.
That worked for me.
Also do check if you've set your path variables correctly.

npm not working after clearing cache

Before clearing cache
npm cache clear
npm is working fine. After clearing cache, it is not working.
The error log below suggest problem with internet connectivity but internet connection is just fine.
This problem does not only happen for bower but for any modules.
Here's the output of process:
> sudo npm install -g bower Password: npm http GET
> https://registry.npmjs.org/bower npm http GET
> https://registry.npmjs.org/bower npm http GET
> https://registry.npmjs.org/bower npm ERR! network connect ETIMEDOUT
> npm ERR! network This is most likely not a problem with npm itself npm
> ERR! network and is related to network connectivity. npm ERR! network
> In most cases you are behind a proxy or have bad network settings. npm
> ERR! network npm ERR! network If you are behind a proxy, please make
> sure that the npm ERR! network 'proxy' config is set properly. See:
> 'npm help config'
>
> npm ERR! System Darwin 12.5.0 npm ERR! command
> "/usr/local/Cellar/node/0.10.16/bin/node" "/usr/local/bin/npm"
> "install" "-g" "bower" npm ERR! cwd /Users/username npm ERR!
> node -v v0.10.16 npm ERR! npm -v 1.3.8 npm ERR! syscall connect npm
> ERR! code ETIMEDOUT npm ERR! errno ETIMEDOUT npm ERR! npm ERR!
> Additional logging details can be found in: npm ERR!
> /Users/username/npm-debug.log npm ERR! not ok code 0
This worked for me:
npm cache clean --force
It should be
npm cache clean
See https://docs.npmjs.com/cli/cache.html
"As of npm#5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use
npm cache verify
instead."
try this one
npm cache clean --force
after that run
npm cache verify
Try npm cache clean --force if it doesn't work then manually delete %appdata%\npm-cache folder.
and install npm install npm#latest -g
It worked for me.
visit this link
I try to
npm cache clean
But npm said newer version on npm (> 5) has self healing Mechanism
and every thing i need to do for checking npm is use verify
npm cache verify
npm message :
The npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid.
If you want to make sure everything is consistent, use 'npm cache verify' instead.
but for forcing npm use this:
npm cache clean --force
Try npm cache clean --force if it doesn't work then manually delete %appdata%\npm-cache folder.
Environment path may have been removed.
Check it by typing,
npm config get prefix
This must be the location where the npm binaries are found.
In windows, c:/users/username/AppData/Roaming/npm is the place where they are found.
Add this location to the environment variable. It should work fine.
(Control Panel -> Search for 'Environment Variables' and click on a button with that name -> edit Path -> add the above location)
at npm#6.8.0 the command that is been supported is npm cache verify
I solved this issue by running cmd as an administrator.
before that, I was trying to run in vs code.
run it in Power Shell or Cmd with administrative privilege. I hope that it will help.
npm install –g #angular/cli#latest
npm cache clean --force
or
npm cache clean
after that run
npm cache verify
npm install --cache /tmp/empty-cache
rm C:\Users\<User>\AppData\Local\npm-cache\

Resources