When installing node with
nvm, it works great in the terminal - you can run node applications with
node path/to/app.js, as you'd expect.
However, if you create an Application Menu launcher in Kubuntu/KDE, it will not work - it can't find the node binary node unless you explicitly give it the complete path, i.e.
/home/xxx/.nvm/versions/node/v12.13.1/bin app.js. When node is installed directly (via apt rather than nvm), this is not necessary.
However, even specifying the full path does not work for npm. For example, creating a menu launcher with command
bash -c "cd /path/to/project ; /home/xxx/.nvm/versions/node/v12.13.1/bin/npm run script-name; read -n 1", the resulting terminal window shows
/usr/bin/env: 'node': No such file or directory (the final
read -n 1 is just to prevent the terminal from closing right after the error).
So the question is: why can KDE's application menu not find the node/npm binaries, and more importantly, how can one create a launcher that will work with npm?