# Problem - npm: not found

**URL:** <https://discourse.nodered.org/t/problem-npm-not-found/71856>\
**Category:** General\
**Created:** [8 December 2022 11:08 UTC](https://discourse.nodered.org/t/problem-npm-not-found/71856 "2022-12-08T11:08:17Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yury](https://avatars.discourse-cdn.com/v4/letter/y/f19dbf/32.png) [@Yury](https://discourse.nodered.org/u/Yury)\
**Post date:** [8 December 2022 11:08 UTC](https://discourse.nodered.org/t/problem-npm-not-found/71856/1 "2022-12-08T11:08:17Z")

</div>

Good afternoon, everyone.  
Please help.

```auto
root@GigaIII-YN:/opt/bin$ node -v
v16.16.0

```

Decided to update NPM:  
`npm install -g npm@9.2.0`

As a result:

```auto
root@GigaIII-YN:/opt/bin$ npm -v
/opt/bin/sh: npm: not found
root@GigaIII-YN:/opt/bin$ which npm
/opt/bin/npm

```

What to do?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 December 2022 12:55 UTC](https://discourse.nodered.org/t/problem-npm-not-found/71856/2 "2022-12-08T12:55:15Z")

</div>

How did you install `node` ?

---

<div class="post-metadata">

**Author:** ![Yury](https://avatars.discourse-cdn.com/v4/letter/y/f19dbf/32.png) [@Yury](https://discourse.nodered.org/u/Yury)\
**Post date:** [8 December 2022 13:34 UTC](https://discourse.nodered.org/t/problem-npm-not-found/71856/3 "2022-12-08T13:34:43Z")

</div>

[knolleary](https://discourse.nodered.org/u/knolleary)  
Thank you very much for responding.  
Your simple question took me a lot of time to bring up all the records from 2 years ago.

I Install it like this more than 2 years ago.

1. Downloaded the file:  
[http://bin.entware.net/mipselsf-k3.4/installer/mipsel-installer.tar.gz](http://bin.entware.net/mipselsf-k3.4/installer/mipsel-installer.tar.gz)
2. Created the Install folder on the flash drive
3. Copied the downloaded file into it
4. Inserted the USB flash drive into the router and waited for the installation to finish
5. Completed:  
`opkg install http://bin.entware.net/mipselsf-k3.4/test/node-red_1.1.3-1_mipsel-3.4.ipk`
6. The packages of Node RED itself were installed through its Web GUI.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 December 2022 13:53 UTC](https://discourse.nodered.org/t/problem-npm-not-found/71856/4 "2022-12-08T13:53:19Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![Yury](https://avatars.discourse-cdn.com/v4/letter/y/f19dbf/32.png) [@Yury](https://discourse.nodered.org/u/Yury)\
**Post date:** [8 December 2022 14:18 UTC](https://discourse.nodered.org/t/problem-npm-not-found/71856/5 "2022-12-08T14:18:15Z")

</div>

[знаток](https://discourse.nodered.org/u/knolleary)  
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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 December 2022 15:13 UTC](https://discourse.nodered.org/t/problem-npm-not-found/71856/6 "2022-12-08T15:13:53Z")

</div>

> [@Yury](#):
>
> ```auto
> root@GigaIII-YN:/opt/bin$ npm -v
> /opt/bin/sh: npm: not found
> root@GigaIII-YN:/opt/bin$ which npm
> /opt/bin/npm
> 
> ```

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.

---

<div class="post-metadata">

**Author:** ![Yury](https://avatars.discourse-cdn.com/v4/letter/y/f19dbf/32.png) [@Yury](https://discourse.nodered.org/u/Yury)\
**Post date:** [8 December 2022 16:33 UTC](https://discourse.nodered.org/t/problem-npm-not-found/71856/7 "2022-12-08T16:33:29Z")

</div>

Thank you for advice:

```auto
root@GigaIII-YN:/opt/bin$ ls -l /opt/bin/npm
lrwxrwxrwx 1 root 1000 38 Dec 8 12:01 /opt/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js

```

This file /opt/bin/npm:

```auto
#!/usr/bin/env node
require('../lib/cli.js')(process)

```

This file /opt/lib/node\_modules/npm/bin/npm-cli.js:

```auto
#!/usr/bin/env node
require('../lib/cli.js')(process)

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 December 2022 16:41 UTC](https://discourse.nodered.org/t/problem-npm-not-found/71856/8 "2022-12-08T16:41:56Z")

</div>

/opt/bin/npm and /opt/lib/node\_modules/npm/bin/npm-cli.js are the same file (as the first is just a link to the second.

Does the `required` file exist? /opt/lib/node\_modules/npm/lib/cli.js

---

<div class="post-metadata">

**Author:** ![Yury](https://avatars.discourse-cdn.com/v4/letter/y/f19dbf/32.png) [@Yury](https://discourse.nodered.org/u/Yury)\
**Post date:** [8 December 2022 16:52 UTC](https://discourse.nodered.org/t/problem-npm-not-found/71856/9 "2022-12-08T16:52:01Z")

</div>

> [@Colin](#):
>
> Does the `required` file exist? /opt/lib/node\_modules/npm/lib/cli.js

Yes, it exists. And as far as I understand, it is executable (there is an asterisk in the MC).

But

```auto
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

```

![lib](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cfcf3047be39583a03b543058a13d8058be8e162.jpeg)  
 ![bin](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/9/a932b795347d526968957d0a118a088fa3f36369.jpeg)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 December 2022 17:18 UTC](https://discourse.nodered.org/t/problem-npm-not-found/71856/10 "2022-12-08T17:18:41Z")

</div>

> [@Yury](#):
>
> `root@GigaIII-YN:/opt/lib/node_modules/npm/lib$ npm.js -v`

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.

---

<div class="post-metadata">

**Author:** ![Yury](https://avatars.discourse-cdn.com/v4/letter/y/f19dbf/32.png) [@Yury](https://discourse.nodered.org/u/Yury)\
**Post date:** [8 December 2022 17:35 UTC](https://discourse.nodered.org/t/problem-npm-not-found/71856/11 "2022-12-08T17:35:21Z")

</div>

[Colin](https://discourse.nodered.org/u/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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 February 2023 17:35 UTC](https://discourse.nodered.org/t/problem-npm-not-found/71856/12 "2023-02-06T17:35:38Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
