0

If I use the commands

apt npm install -g npm

or

npm install -g npm@6.14.10

I still get npm@5.6.0. It's really strange. I also removed everything and installed it again, but it didn't work.

Following Error comes:

npm install -g npm

npm WARN npm npm does not support Node.js v14.15.3
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! cb.apply is not a function

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/tom/.npm/_logs/2021-01-03T11_35_05_408Z-debug.log
npm version

npm WARN npm npm does not support Node.js v14.15.3
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
{
    npm: '5.6.0',
    ares: '1.16.1',
    brotli: '1.0.9',
    cldr: '37.0',
    icu: '67.1',
    llhttp: '2.1.3',
    modules: '83',
    napi: '7',
    nghttp2: '1.41.0',
    node: '14.15.3',
    openssl: '1.1.1g',
    tz: '2020a',
    unicode: '13.0',
    uv: '1.40.0',
    v8: '8.4.371.19-node.17',
    zlib: '1.2.11'
}

Don't know what I need to change, to solve my problem. I am very thankfull for every help.

Update: (thanks to @Mr.)

Using command: npm upgrade -g npm --verbose

npm info it worked if it ends with ok
npm WARN npm npm does not support Node.js v14.15.3
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm verb cli [
npm verb cli   '/usr/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'upgrade',
npm verb cli   '-g',
npm verb cli   'npm',
npm verb cli   '--verbose'
npm verb cli ]
npm info using npm@5.6.0
npm info using node@v14.15.3
npm verb npm-session 78951400057ee470
npm verb update computing outdated modules to update
npm verb stack TypeError: cb.apply is not a function
npm verb stack     at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
npm verb stack     at FSReqCallback.oncomplete (fs.js:184:5)
npm verb cwd /home/tom
npm verb Linux 5.4.0-58-generic
npm verb argv "/usr/bin/node" "/usr/local/bin/npm" "upgrade" "-g" "npm" "--verbose"
npm verb node v14.15.3
npm verb npm  v5.6.0
npm ERR! cb.apply is not a function
npm verb exit [ 1, true ]
Salma558
  • 55
  • 1
  • 10

1 Answers1

1

npm version has a constraint on node version, that is why you get the following error

npm WARN npm npm does not support Node.js v14.15.3
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

to install the latest npm version that coincide with node version, then just upgrade npm as follows

npm upgrade -g npm

otherwise, upgrade your node to latest version before you try to install latest version of npm.

since you mentioned using sudo and did not mention whether are you using node version manager, it i hard to debug the issue for you in this manner (there is no way to know how your environment is configured).

will recommend you to try to run npm in verbose mode

npm upgrade -g npm --verbose

to gather more information.

Mr.
  • 9,429
  • 13
  • 58
  • 82
  • this is exactly what I have done before. I am having the latest version of Node js (14.15.3) but the command ` npm upgrade -g npm` doesn't work. So still, I don't get any latest npm version. Do you have an Idea why? – Salma558 Jan 03 '21 at 13:20
  • 1
    @Tom: i've updated my comment. yet, npm tells you exactly what is the issue (i even quoted it) - a version mismatch. – Mr. Jan 03 '21 at 14:31
  • sorry that I didn't give all the informations @Mr.. I am new into this, and I forgot... So please, I used the command `npm upgrade -g npm --verbose` and updated my question. – Salma558 Jan 03 '21 at 15:42