cb() not called

cb() not called

I was looking for how to upadte my angular/cli when I called this. Also I went to npm support because my version was not updating properly, I got a nasty reply

npm outdated -g --depth=0

OS : Linux Ubuntu 16.04 LTS
node : 10.16.3
npm : 6.9.1

debug log

0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/bin/node’, ‘/usr/bin/npm’, ‘outdated’, ‘-g’, ‘–depth=’ ]
2 info using npm@6.9.0
3 info using node@v10.16.3
4 verbose npm-session 46991ae97b6e38ca
5 timing npm Completed in 4870ms
6 error cb() never called!
7 error This is an error with npm itself. Please report this error at:
8 error https://npm.community

The debug log looks like you missed the zero off the end? But I was not able to reproduce the error, so likely does not explain the error.

There have been a lot of good bug fixes since npm 6.9.1, so if you are able to update npm I suggest update and try the command again.

well to update npm to the latest version

npm install -g npm --timing (so you can see the logs)

it claimed it updated to 6.11.2
but npm -v still says 6.9.0
2019-09-04T02_24_15_143Z-debug.log (137.1 KB)

The logs show you are running
/usr/bin/npm
but are installing npm global modules to
/home/uoul/npm

npm is itself a global npm module (!) so you now have two installed and are still running the old one.

Have you changed the global install location? e.g. On my Mac I see:

$ npm prefix -g
/usr/local
$ command -v npm
/usr/local/bin/npm

I never changed the global install location, how do I go about fixing this because npm can get messy if theres bugs with it. I never had the time to dive into npm so I need step by step careful help. Do you think another piece of software might have come in and modified npm?

Also my ubuntu version is 16.04.5 LTS not any of the MAC OS, and if we fix npm there should be a glaring bug in the the software that started this mess in the first place

I do not know what your setup is or how it got there, but we can hopefully sort it out, one thing at a time.

  1. Do you control this machine? (i.e. is it appropriate that you change the version of npm installed globally?)

  2. What does this command show for you? (Format the output in your reply using “Preformatted text” by using the </> control.)

npm config list

(npm config lists config settings: https://docs.npmjs.com/cli/config)

I am the admin with full control
the formatting did not do anything heres the result form
npm config list

; cli configs
metrics-registry = “https://registry.npmjs.org/
scope = “”
user-agent = “npm/6.9.0 node/v10.16.3 linux x64”

; userconfig /home/uoul/.npmrc
prefix = “/home/uoul/npm”

; node bin location = /usr/bin/node
; cwd = /home/uoul
; HOME = /home/uoul
; “npm config ls -l” to show all defaults.

/usr/bin/npm /usr/bin/node, are you familiar with Linux you might be making a misjudgement

/usr/bin /bin are where system wide commands are stored place where the OS uses PATH to look for relative-given executables,

Realizing this im now certain that there is one npm installation on my machine

You have a prefix configuration in your user npm settings:

; userconfig /home/uoul/.npmrc
prefix = "/home/uoul/npm"

This changes where npm installs global packages, including when you use npm to install itself. Documentation:

You can confirm this another way by running the command I listed earlier:

npm prefix -g

There are two ways forward from here, you could delete the prefix and install global packages to the system location, or you could modify your PATH so that commands installed locally are found. (And it could be that PATH is already modified and it is just that you have npm in two locations.)

(A reason for installing global modules to your home folder is that so you don’t need to use sudo when installing or updating them. The node version managers often support this mode of operation, such as n and nvm.)

how do I toss out the prefix and redirect all npm related to the directory where its supoosed to go

To delete the prefix configuration setting:

npm config delete prefix

Then because you will be installing global packages to a system folder, you will need to use sudo to install global packages like:

sudo install -g npm

isnt using sudo bad, isnt there another way, mabye i followed a blog and did this to prevent from using sudo

Indeed, the npm documentation recommends avoiding the use of sudo for global installs.

In general your approaches for avoiding use of sudo with global package installs are:

  • change install location to somewhere you own, usually a folder in your home folder
    • by explicitly setting prefix, or
    • by using a node version manager which installs node and npm locally, and implicitly changes prefix
  • change ownership of the destination system folder so you can write there (this is not likely an option if installing to /usr but might seem reasonable if installing to /usr/local)

Let’s follow through with the explicit prefix option then. You already have prefix explicitly set, and probably just need changes to your PATH. What does it currently look like?

echo $PATH

/home/uoul/bin:/home/uoul/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/uoul/npm/bin

You have /usr/bin before /home/uoul/npm/bin in PATH. This is ok for new package commands, but when you type npm you get the old one installed in the system location rather than the new one installed locally.

I see you have two other local folders at the front: /home/uoul/bin, and /home/uoul/.local/bin

I suggest you move /home/uoul/npm/bin to near the start too.

(Some people prefer not to override system binaries with locally installed binaries. So another approach is you could delete the system installed npm.)

so the difference between local and global npm is if the command binarnies are in your path

do I have to modify my path it could wreak havoc, can I only just delete the system installed npm
without modifying path

since there are two npm installed on my machine how do i delete the system-installed one?

since there are two npm installed on my machine how do i delete the system-installed one?

How did you install npm? (Package manager? Running a shell script to download tarball? Part of node, either through package manager or direct script?)

To see if it helps but let you revert, you could just rename the command which is currently found first on your PATH:
sudo mv /usr/bin/npm /usr/bin/npm.renamed