Unable to execute "npm" command with "exec"

Hi!

When you get a shell into the container, the system may run ~/.profile or ~/.bashrc or both.
You can check this out if you add some echo statement in those files to verify which ones run in each case. I did this and here is the result.

$ lxc exec mycontainer -- sudo --user ubuntu --login npm
Running ~/.profile
NPM...
$ lxc exec mycontainer -- sudo --user ubuntu --login 
Running ~/.bashrc
Running ~/.profile
ubuntu@mycontainer:~$ 

Therefore, can you check that you have setup the $PATH in ~/.profile for NPM?