@Yury I am asking about node.js, rather than Node-RED.
Your original post says you have Node v16.16.0 - which is quite recent. So you must have installed/updated it more recently than two years ago.
A normal node.js install will include npm. For some reason it is not included for you.
What platform/os is this on? The instructions you've shared for installing Node-RED are not ones I recognise - they certainly haven't come from us. So is this a custom piece of hardware you are using? Or a particular OS that provides its own packages for node.js and node-red?
знаток
You are absolutely right, I updated to this version a month ago. Originally there was, of course, a younger version.
And until today, there was also npm. But after it was removed by the npm install -g npm@9.2.0
and the system stopped seeing him.
In my case, today NodeRed is a NodeJS package, which itself is a package of system Entware. And this system is deployed on the Linux operating system, which runs on a home router.
Which, of course, is very convenient and, most importantly, reliable. For 4 years, I have never had any NodeRed failures, not counting those caused by my inexperience. I was among the first in the country who started working on such hardware.
Taking this opportunity, I would like to thank you from the bottom of my heart for your work in creating and developing such a wonderful programming environment.
What does this show ls -l /opt/bin/npm
if it says it is a link to somewhere else, does that file exist? If not then I suspect that npm has been installed somewhere else.
Yes, it exists. And as far as I understand, it is executable (there is an asterisk in the MC).
But
root@GigaIII-YN:/opt/lib/node_modules/npm/bin$ npm -v
/opt/bin/sh: npm: not found
root@GigaIII-YN:/opt/lib/node_modules/npm/lib$ npm.js -v
/opt/bin/sh: npm.js: not found
It is cli.js not npm.js
To execute a file that is not in the path you have to address it directly, so from that folder it would be ./cli.js
But I don't think that file is supposed to be executed directly.
Sorry, I have no idea what is going on, possibly the npm you have installed is not compatible with the node.js that you have. The only suggestion that I have is to uninstall node.js and npm and then reinstall node.js, which should give you a working version of npm that is compatible with nodejs 16. Then don't try to upgrade npm to a later version.
Colin
Even if it is not clear to you - an experienced one - then, of course, I will follow your advice and I will do it right now.
I will put everything from the very beginning