Score:0

Using sudo gives me a different version of node than what I have

gd flag

I am on Ubuntu 22.04 and trying to install angular/cli globally. I am getting this warning:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'pacote@15.0.6',
npm WARN EBADENGINE   required: { node: '^14.17.0 || ^16.13.0 || >=18.0.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.10.0' }
npm WARN EBADENGINE }

I found multiple questions on stackoverflow regarding this problem. The answers all point at using a stable version of node. I have node version 18.12.1 which currently is the latest stable version and npm version 8.19.2 that comes with it.

Now I know that people will be asking in the comments if I have node version 18.12.1 installed, so here it is:

jan@ubuntu-22-04:~$ node -v
v18.12.1
jan@ubuntu-22-04:~$ npm -v
8.19.2
jan@ubuntu-22-04:~$ 

But then the warning seems to suggest that I have node version 12.22.9 and npm version 8.10.0.

npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.10.0' }

So what is going on??? Is my understanding of the warning incorrect? Is there a Ubuntu-problem that I don´t understand? Can anybody please help me out?

EDIT: It looks like I have two different versions of node. Look at this:

jan@ubuntu-22-04:~$ node -v
v18.12.1
jan@ubuntu-22-04:~$ sudo node -v
v12.22.9
jan@ubuntu-22-04:~$ npm -v
8.19.2
jan@ubuntu-22-04:~$ sudo npm -v
8.10.0

Using sudo gives me version 12.22.9 as the warning states. I still don´t know how to solve it. Can anybody help?

user4556274 avatar
ru flag
Where have you installed the two versions of `node` ? `type -p node` and `sudo bash -c 'type -p node'` (adjust if your preferred shell is not `bash`)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.