Skip to content

Latest commit

 

History

History
98 lines (58 loc) · 4.76 KB

File metadata and controls

98 lines (58 loc) · 4.76 KB

Install Commands — What They Actually Do

When you build something, you almost never write everything from scratch. Other people have already built pieces — a login system, a database connector, a payment processor. These pieces are called packages (also called libraries or modules — same thing, different word depending on who's talking).

Install commands download those packages onto your machine or into your project.


npm install

Used for: JavaScript and Node.js projects — React, Next.js, Express, anything in the JS world.

What it does: Reads your package.json file (your project's ingredient list) and downloads everything on that list into a folder called node_modules.

Common uses:

  • npm install → download everything in the list
  • npm install stripe → download the Stripe package and add it to your list
  • npm install -g vercel → install Vercel as a tool for your whole computer (-g = global, means "everywhere, not just this project")

Before npm works: You need Node.js installed first. Node.js is the engine. npm is one of the tools that comes with it. Get Node.js at nodejs.org — npm arrives automatically.

Where packages go: A folder called node_modules/ inside your project. Never touch it manually. Never push it to GitHub. Add node_modules to your .gitignore file.

"npm: command not found" → Node.js isn't installed. Install it from nodejs.org, restart your terminal, try again.

"should I open a folder first?" → Only if you're doing a local install (no -g). Local installs go into whichever folder you're standing in. Global installs (-g) don't care where you are.


pip install / pip3 install

Used for: Python projects — Django, FastAPI, Flask, bots, scripts, anything Python.

What it does: Downloads a Python package from the internet and installs it so your code can import and use it.

Common uses:

  • pip3 install requests → install the requests package
  • pip3 install -r requirements.txt → install everything on the list (requirements.txt is Python's version of package.json)

pip vs pip3: Use pip3. On most systems, pip alone sometimes points to an older Python version you don't want. pip3 is always the right one.

If you're using Docker: Running pip3 install on the server does nothing to your Docker container. The container is a sealed lunchbox — changes on the server outside the box don't reach inside it. To add a package, put it in requirements.txt, then rebuild: docker-compose down && docker-compose up --build.

"pip: command not found" → Try pip3 instead. If that also fails, Python isn't installed or your terminal can't find it. Install Python from python.org.


bun install

Used for: JavaScript projects — same job as npm, just faster.

What it does: Same as npm install. Bun is an alternative JavaScript runtime that handles packages much quicker.

Common uses:

  • bun install → install everything in package.json
  • bun add stripe → add and install Stripe

Before bun works: Install it first with this command: curl -fsSL https://bun.sh/install | bash Then restart your terminal.


brew install (Mac only)

Used for: Installing developer tools on a Mac — not project packages, but the tools themselves (git, Node, Python, etc.)

What it does: Homebrew is a tool that installs other tools. Think of it as the App Store for developer software on Mac.

Common uses:

  • brew install node → install Node.js (which includes npm)
  • brew install git → install git
  • brew install python → install Python

Before brew works: Install Homebrew first. Go to brew.sh and run the one-line command they show you. Takes about 2 minutes.


Global vs local — the invisible rule that trips everyone up

Global install = installs a tool for your whole computer. Use it from any folder, any project. Examples: npm install -g vercel, brew install node, pip3 install black

Local install = installs a package just for this project. Goes in your project folder. You need to be in the right folder first. Examples: npm install stripe, pip3 install requests

The tell: if you're setting up a tool (Vercel CLI, git, Python, Node) → usually global. If you're adding a feature to your specific project (Stripe, a database connector, a PDF library) → local, and you need to be in your project folder.


The "it installed but it still says not found" problem

This usually means one of three things:

  1. You installed it globally but your code is looking for it locally in the project (or vice versa)
  2. You installed it on the server but the app is running in Docker (the sealed lunchbox problem)
  3. Your terminal needs to be restarted to see the new installation

When in doubt: close the terminal, open a new one, try again.