Issues upgrading nodejs

I have run the following:
apt install nodejs and got the v8
apt list nodejs
Listing... Done
nodejs/stable,now 8.11.1~dfsg-2~bpo9+1 armhf [installed]

however when running node -v I still get:
pi@DietPi:~ $ node -v
v6.10.0

I have upgraded node-red to latest v0.19:
sudo npm install -g --unsafe-perm node-red
npm WARN deprecated mailparser@0.6.2: Mailparser versions older than v2.3.0 are deprecated
npm WARN deprecated nodemailer@1.11.0: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
npm WARN deprecated mimelib@0.3.1: This project is unmaintained
npm WARN deprecated mailcomposer@2.1.0: This project is unmaintained
npm WARN deprecated buildmail@2.0.0: This project is unmaintained
/usr/local/bin/node-red -> /usr/local/lib/node_modules/node-red/red.js
/usr/local/bin/node-red-pi -> /usr/local/lib/node_modules/node-red/bin/node-red-pi
/usr/local/lib
└── node-red@0.19.0

and node -v still reports v6

When I do:
pi@DietPi:~/.node-red $ npm rebuild
[..................] - : info using node@v6.10.0

Please help upgrading to the latest version on a raspberry PI.

I suggest you first uninstall nodejs
sudo apt remove nodejs
then run the bash <(curl script from the pi installation docs to upgrade everything node-red related.
https://nodered.org/docs/hardware/raspberrypi

Note this is the dietpi distribution, not raspbian. May need @dceejay to confirm best practice on whether the script is expected to work of dietpi.

Why don't you try to install using the Dietpi built in system - dietpi-software?

Indeed. Diet pi should use the dietpi software installer

tried to use that and get error. I submitted a ticket there too.

They probably need to update their install script to make sure that Nodejs is at version 8 for node-red 0.19. They are usually very responsive to posts.

Node-RED 0.19 supports Node 4.8 or later - but it will be the last milestone release that supports anything before Node 8.

Thanks Nick, I misread the release notes. Sorry for the confusion!

I was under the impression that I have to upgrade to nodejs v8.
Please confirm that I can keep using nodejs v6 as it was not clear from the release notes

With help from DietPi support was able to upgrade nodejs to v8.11