Zsh shell can't run npm

I don’t know why zsh can’t find npm. See screenshot below:

I tried checking the path and I had to do some kind of fancy footwork to install the mongo shell previously when I took the M001 course, now I wonder if that’s causing me problems. I don’t recall what I did in the first place, unfortunately. I am pretty new to all this. Here’s another screenshot in case it’s helpful:

Using Mac Catalina.


The screenshot is repeated, you probably want to upload a different one.

And can print your path using echo $PATH?

Sorry, I replaced the second screenshot so they are now different. The second one shows the echo $PATH.

Here’s the same info without name blocked out in case for some reason it’s helpful to see…

Screen Shot 2020-10-06 at 2.34.27 PM
Screen Shot 2020-10-06 at 2.34.55 PM

You might expect someone else to help, but this is what I myself would try:

The problem may be that npm is on a different PATH, or it’s not installed. If you re-install node, it will probably fix the path for you.

If that solution does not work (but it should), I came across a nice post on SO about installing node.

Good luck!

That helped to install again, so thank you for that suggestion. I mean it at least made something different happen, but it is still not doing what I think it’s supposed to do.

I don’t know what’s wrong this time. Well, I mean the first time I forgot to cd to the right location, but then it still had issues. Here’s a screenshot:

npm is node package manager, it allows you to install programs written in javascript, located somewhere on the cloud.

There are two ways you normally install a program

  1. npm install <package-name>
  2. npm install

For the first method, you need the name of a package, normally found in the official npm site. This is normally used when you are creating your own App. And it requires you previously run npm init or npm init -y if you’re starting with npm. (this step creates a package.json file)

The second method is useful when you’re using someone else’s app. In this case there must be a package.json in the folder.

You have an App, you cd into the folder, let’s say:

  • cd App/.
  • List the storage ls . or just ls and there must be a package.json otherwise it will return an error, as you are getting there.
  • if there is, you can run npm install

Hope that helps you get started.


I didn’t see your response until after I (hope) got it working correctly, but it is very very helpful that you explained how npm works, I think that should help me a lot in the future as well. I really appreciate you taking the time to share your knowledge!!

I just started over from scratch. I moved everything out of my downloads folder that I wanted to keep, deleted everything I didn’t need to keep, emptied my trash, then re-downloaded the mflix-js.zip file and unzipped right there in the downloads folder. I think maybe the issue was the hidden files or possibly just that I was not able to run from inside mflix-js as the instructions said to do. Once I ran npm install from inside the downloads folder it seemed to work fine. Hopefully that is the case. Thanks for sticking with me through this, I am new to all this stuff and trying my best to keep up.

Screen Shot 2020-10-06 at 3.28.06 PM

1 Like

You’re welcome, good luck and be patient :slight_smile:

1 Like