If close the window ,the service do not keep running in the background.
I find a similar topic in Unhandled rejection Error: EACCES: permission denied,.
sudo apt-get purge nodejs
bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
also no effect.
Thanks.