Why isn't Node.js coming with NPM when installed? - node.js

I downloaded Node.js via https://nodejs.org/en/ and installed it successfully. In Terminal, I ran the command node -v which then gives me v11.2.0 indicating that Node.js is indeed installed.
However, upon running npm -v I get an error that says: -bash: npm: command not found. I've looked at everything online, tried everything I possibly could but no luck at all.
It's very frustrating because it said that npm comes with node but it looks like it doesn't.
How can I fix this?
Edit: I'm on Mac

Related

`npx create-react-app my-app` is trying to use the wrong npm

I'm using a MacBook Pro.
I have a fresh install of nvm. I set the node version and it's set to 16.17.0 and npm -v and nix -v both show 8.15.0.
When I run npx create-react-app my-app it fails and the log shows the following...
info using npm#6.5.0
Where is this coming from, and how do I fix it?
I originally installed a number of recent and not-so-recent versions of node.js with Homebrew and I had the exact same error. I completely annihilated every instance of node.js and npm from /usr/bin and /usr/local/bin. There is nothing related in my $PATH, but there must be a reference somewhere.
Well, I played around and discovered that installing version 14.0.0 of node.js plays nicely and my app is now created... but I am now getting...
npm WARN npm npm does not support Node.js v14.0.0
I'm still confounded by the original error because I also tried with 12.0.0 and it tried to work and failed in a nice manner with an error that I could play along with. I'm still baffled by the original error.

NPM not working correctly on Raspberry Pi

So I have a raspberry pi Model 3 B+ and I need NodeJS on it. It has actually been installed for a while now (2-3 weeks) and I have been building a server on it since then. NPM has worked and installed packages up until yesterday.
Yesterday, I had installed the package restify-clients, and I came back to see that NPM/Node had an incremental update (I think from 6.10.1 to 6.10.2 or something like that). So I copied the command it gave me and ran it, which I assumed would update the package. I'm choosing to believe these actions are the reason why NPM does not work anymore.
Running any npm command does not hang, it just returns like nothing was run.
Running which npm returns /usr/local/bin/npm, running sudo which npm returns the same. Running npm -v returns nothing, running /usr/local/bin/npm -v returns nothing. /usr/bin/npm points to /usr/lib/node_modules/npm/bin/npm-cli.js, /usr/local/bin/npm points to /usr/local/lib/node_modules/npm/bin/npm-cli.js.
Running any command like npm init or npm install does nothing as well.
I have tried reinstalling NodeJS from nodesources twice, and both times NPM is installed into the directories but running any NPM just returns.
For extra information, running nodejs -v and node -v works and returns a version number.
Any suggestions?
Thank you.
Uninstall node package and only keep nodejs, so npm should be working again.

npm 'command not found' no matter what I try

On MacOS:
I'm unable to execute any npm package command. Every time I try, I see command not found. Like so:
-bash: live-server: command not found
I've installed node.js directly from the website.
https://nodejs.org/en/download/
I've installed live-server globally, and locally. It appears to work. When I try the command, it fails.
I've removed node.js and npm, re-installed and still fail to execute a command. I'm quite stumped. I've reviewed similar posts, implemented the suggested solutions and still can't manage to execute any npm command.
Several of the posts I've reviewed:
sudo: npm: command not found
NPM Command Not Found After Installing Node
What should I do next?
Are you using Windows?
Did you check if NPM is in Path on "Environments variable"
My bash_profile file had the wrong data saved. Correcting the file solved the problem.

Node and npm installation using brew

I am doing some setup whcih required me to uninstall earlier node and npm setup, and install again using brew. But when i uninstalled it, and then installed it using brew install node, it gives me an error "bash: /usr/bin/npm: No such file or directory"
I uninstalled them once again, and when I type node (to see which path it is called in) I get, "bash: /home/username/.linuxbrew/bin/node: No such file or directory"
Whereas if I type npm I get, "bash: /usr/bin/npm: No such file or directory"
I think maybe the reason of error is this discrepancy in both the paths. Any suggestions on how to install it correctly using brew?
You made the same mistake I did. There are bad instructions on the internet for how to install node which come up on top on Google. They say install npm separately. Wrong. npm is included with nodejs (It's not called "node" either. Nodejs will tell you that the name "node" is a different program by a different author.)
Follow these instructions:
https://nodejs.org/en/download/package-manager/

Issues with Npm in Node Windows executable

Problem
I recently updated to the latest version of node which is supposed to come with npm pre-installed. Although all the files are there, when I try to call something like npm help in node I get a hanging .... If I try to run it directly from command prompt I get this error:
Any Idea on what the possible issue could be? I am running on windows 7 btw.
Ideas
Pathing issues?
Conflict with previous installation?
Should I just install manually rather than the executable?
Thanks in advance for your help!
Don't call npm with node, if you want to see if npm is installed properly (and is in your path) execute the following command in the terminal:
npm -v
If you want to install a module: npm install express

Resources