/bin/sh: npm: command not found

If you encounter this problem when developing WeChat Mini Programs. First check if it’s the same situation as mine. Using Nodejs installed by nvm on Mac. Solution:

which node

First get the current Nodejs path

ln -s /Users/#{username}/.nvm/versions/node/#{nodeVersion}/bin/npm /usr/local/bin/npm
ln -s /Users/#{username}/.nvm/versions/node/#{nodeVersion}/bin/node /usr/local/bin/node