Npm error when installing beta

Hi i installed node-red version v 0.20.5 on a raspberry pi 3b+ with the latest raspbian stretch desktop
with this command:
bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

When i enter to upgrade to the latest beta:
sudo npm install -g --unsafe-perm node-red@next
i get: sudo: npm: opdracht niet gevonden

i read that i had to specify @next, do i have to type something else, so what?

@update
Hi i installed node-red version v 0.20.5 on a raspberry pi 3b+ with the latest raspbian stretch desktop
with this command:
bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

When i enter to upgrade to the latest beta:
sudo npm install -g --unsafe-perm node-red@next
i get: sudo: npm: opdracht niet gevonden

i read that i had to specify @next, do i have to type something else, so what?

i did
$ sudo apt-get install npm

and then i tried again
sudo npm install -g --unsafe-perm node-red@next

npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "--unsafe-perm" " node-red@next"
npm ERR! cwd /usr/local/bin
npm ERR! node -v v8.11.1
npm ERR! npm -v 1.4.21
npm ERR! code E405
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/local/bin/npm-debug.log
npm ERR! not ok code 0

and then again:

  • the above bashscript
  • sudo npm install -g --unsafe-perm node-red@next

and now it works!

It should not have been necessary to install npm using apt, it should have been installed by the script. I suggest you uninstall it and run the script again.
Do you see any errors on the terminal?
If not then what do these commands show

apt-cache policy nodejs
node -v
npm -v

Just noticed that you have recovered the situation by running the script again.