Run nodejs installed as snap package [duplicate]

I am running Ubuntu 18.04 and want to install a specific version of node using snap. I have installed this version successfully but when I run

node --version

I get the version I have installed using apt. How can I get it to use the node executables installed with snap and not the ones in '/usr/bin'? I've tried adding the path to the snap install to the PATH variable but it keeps picking the one installed by apt. I tried purging the the apt install but that didn't work because of reasons, and I kind of feel I shouldn't have to. Any suggestions? I can run node with:

snap run node

but what I wan't is when typing

> node

it should use the snap install. And when I run:

> which node

it should resolve to something like '/snap/nodejs/current/bin' and not '/usr/bin/node'

3 Reset to default

You Might Also Like