I'm learning laravel and follwing this tutorial,
But when I went try and install npm, is says bash: npm: command not found
two steps to do is to (1) which node (2) which npm which should be both in /usr/local/bin (where homebrew installs/symlinks node+npm)... to resolve.. try (1) brew doctor (2) brew reinstall node if its still giving issues.. check your path (echo $PATH).
On Windows, the cause of this error could be that a PATH or system variable is not correctly set. The error can also occur if you do not have npm or Node. js installed, have an outdated version, or have permission issues.
In git Bash, a Linux like environement is simulated so you can access your Linux filesystem with Linux style paths. Type then node --version and npm --version to check that node and npm are available.
npm install -g pm2 - pm2 will be installed globally. It will then typically be found in /usr/local/lib/node_modules (Use npm root -g to check where.) If you're using nvm, then your global modules may be in one of several places depending on the version of node you're using at the time.
If you have already installed nodejs and still getting this error. npm: command not found..
run this
apt-get install -y npm
I also come here for the same problem, The solution I found is to install npm and then restart the Visual Studio Code
in redhat base OS (tested in centos 7)
yum install nodejs npm -y
in debian base OS
apt-get install -y npm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With