npm command 'serve ' not found, although it is installed

You should not install the packages globally.Try to do the following-

npm uninstall -g serve 
npm i -S serve

Let me know if this works.


Make sure to have this in your .bashrc or .zshrc

if you're using Yarn:

export PATH="$PATH:$(yarn global bin)"

if you're using NPM:

export PATH="$(npm bin -g):$PATH"

So that the shell would know where to look for executables such as serve, npx, live-server etc that are installed globally.

Make sure to reload your shell config:

source ~/.bashrc // or ~/.zshrc

Tags:

Linux

Npm

Serve