Create your own
Lesson illustration

Obtaining Backend Files Before Running Setup Commands

Hello, and welcome. This course is a practical Windows setup path for getting a Node.js backend running locally: first obtain the project, then verify Node and npm, enter the correct folder, install dependencies, and start the development server.

Your target commands—

cd backend
npm install
npm run dev

—are not universal commands that create a backend automatically. They operate on a specific backend project that must already exist on your computer. In this lesson, you will learn what “having the project” means, why package.json is essential, and the usual ways to obtain the files before opening PowerShell.


Commands need a project to act on

A backend project is a collection of files arranged in folders. At minimum, it commonly contains:

  • application source code, often in folders such as src;
  • configuration files;
  • a package.json file, which describes the Node project;
  • possibly a .env.example file describing required environment variables;
  • sometimes a backend folder inside a larger project folder.

The three commands each depend on those files:

CommandWhat it needs from the project
cd backendA folder actually named backend in your current location
npm installUsually a package.json file listing the packages the backend needs
npm run devA dev script defined in that package.json file

So the commands are better understood as instructions to a downloaded project, not instructions for downloading or inventing one.

For example, imagine someone gives you only this command:

npm run dev

PowerShell and npm can run the command, but npm must first look in the current directory for package.json. If no backend project has been obtained—or if you are in the wrong folder—npm has no definition of what “dev” means for this application.

The key idea for the whole course is:

Get the project files first; then run setup commands inside the project’s backend folder.


What package.json contributes

package.json is the project’s npm instruction file. It typically records the project name, required packages, and runnable scripts. A simplified backend example might look like this:

{
  "name": "my-backend",
  "scripts": {
    "dev": "nodemon src/server.js"
  },
  "dependencies": {
    "bcryptjs": "^2.4.3",
    "express": "^4.18.0"
  }
}

You do not need to write or edit this file for this course. The important point is that it comes with the backend project.

When you later run:

npm install

npm reads the dependency information in package.json, downloads the packages, and places them in a local node_modules folder. In the example, that could include bcryptjs, which you will use later to make a password hash.

When you run:

npm run dev

npm reads the scripts section and runs the project’s own dev command. Different projects may use different development commands, ports, frameworks, and file structures. That is precisely why the project’s package.json must be present: it provides the specific instructions for that backend.

Specifying dependencies and devDependencies in a package.json file | npm Docs

Read this short npm Docs explanation to connect npm install with the dependency list stored in a project's package.json.

In the opening paragraph of npm Docs' “Specifying dependencies and devDependencies in a package.json file,” read the explanation of package dependencies. Focus on the relationship: the project declares its required packages first, and npm install then downloads the matching packages. This is why installing before obtaining the project cannot install the backend's intended dependencies.

A useful distinction:

  • Project files are the instructions and source code you obtain from the project owner or repository.
  • Dependencies are supporting packages that npm downloads afterward based on those instructions.
  • node_modules is normally created locally by npm install; it is often not included when the project is shared because it can be very large and can be recreated.

Ways you may receive the backend project

Because no repository URL or setup source has been provided yet, do not guess a URL or create an empty folder named backend. You need the real project files from whoever supplied the backend.

There are three common possibilities.

1. Clone a GitHub repository

A GitHub repository stores the project online. Cloning makes a local copy of it on your Windows computer. It normally preserves the project’s folders and Git history, making it the preferred option when you have a repository URL and Git is available.

On a GitHub repository page, the green Code button opens the clone menu. Select HTTPS and copy the displayed URL.

The GitHub repository “Code” menu with the HTTPS clone URL selected; the copy button beside the URL copies the address used with `git clone`.

The eventual pattern is:

git clone https://github.com/OWNER/REPOSITORY.git

This creates a new local folder, usually named after the repository. You would then enter that folder and look for its backend directory.

GitHub for Beginners: Clone, Install, and Run Any Repository

Watch “GitHub for Beginners: Clone, Install, and Run Any Repository” by Alphastack for a brief visual picture of the problem: online source files must become a local project folder before they can be run.

First watch the setup question, which frames the need to bring repository files onto your computer. Then watch the clone demonstration. Notice that git clone creates a local directory with the same project structure as the repository; that resulting directory, not the GitHub webpage, is where later npm commands work.

2. Download a ZIP archive

A project owner might send you a ZIP file, or GitHub may offer Download ZIP in the same Code menu shown above. This gives you a snapshot of the project files without requiring Git.

On Windows:

  1. Find the downloaded ZIP file, usually in Downloads.
  2. Right-click it and select Extract All.
  3. Choose a location you can find later, such as a folder in Documents or Desktop.
  4. Open the extracted folder and look for backend and, inside it, package.json.

Do not run npm commands inside the ZIP file or before extracting it. PowerShell needs access to the real extracted files and folders.

A ZIP download is enough to run a project locally. The main difference is that it is not connected to Git for pulling later updates or sending changes back.

3. Receive an existing project folder

Someone may instead share the whole project folder through a shared drive, USB device, file-transfer service, or a pre-existing folder on your computer. In that case, you do not need to clone or download again. You only need to locate the parent folder that contains the backend.

For example, if the files are arranged as:

Documents
└── client-project
    ├── frontend
    └── backend
        ├── package.json
        └── src

then client-project is the project’s top-level folder, and backend is the folder where the later npm commands belong.


Why a repository usually does not include node_modules

A project can use a handful of packages directly, but each package can depend on many other packages. The resulting node_modules folder can contain thousands of files and consume substantial disk space.

For that reason, a Git repository normally shares:

  • package.json, which declares needed packages;
  • often package-lock.json, which records precise resolved versions;
  • the project’s code and configuration;

but excludes:

  • node_modules, which each developer recreates locally with npm install.

That is not a missing-file mistake. It is the intended workflow: obtain the project’s instructions, then let npm download the required dependencies for your machine.

npm for absolute beginners

Watch this portion of Kevin Powell’s “npm for absolute beginners” to see why a downloaded repository commonly lacks node_modules, and why npm install is the next step only after the project files are present.

Watch recreating dependencies. Focus on the explanation that repositories generally omit the large node_modules folder because the dependency declarations let npm recreate it after the project has been obtained. Ignore the presenter’s specific example packages; the same principle applies to your backend and bcryptjs.


A practical “ready to continue” check

Before proceeding to Node installation or PowerShell navigation, make sure you can identify one real local folder containing the backend.

Your project is ready for the next lessons when all of these are true:

  • You know where the project came from: a GitHub URL, a ZIP file, or a folder someone provided.
  • The files have been cloned or extracted onto your Windows computer.
  • You can open the project folder in File Explorer.
  • You can see a backend folder, if the project instructions use cd backend.
  • Inside backend, you can see package.json.

If you have none of those files yet, the correct next action is to request the project link, ZIP file, or shared folder from the person or instructions that gave you the backend task. Installing Node or typing npm commands cannot substitute for the missing project.

Be cautious about similarly named folders. A blank folder you create yourself named backend is not the backend project; it will not contain the source code, package list, or development script expected by the commands.


Common misunderstandings

“I can run npm install anywhere.”

You can type it anywhere, but it will not necessarily install the backend’s dependencies. npm needs to run in the directory containing the intended package.json. In a random folder, npm either cannot find the project manifest or works with the wrong project.

“GitHub is the project folder.”

GitHub is typically where the project is hosted online. The local project folder is the copy on your own computer after cloning or extracting a ZIP.

“I downloaded a ZIP, so I have installed the backend.”

Not yet. Downloading and extracting gives you the project’s files. npm install later downloads its required Node packages, and npm run dev later starts its development process.

“The node_modules folder is missing, so my download failed.”

Usually, no. Its absence before the first npm install is normal. The important file to find first is package.json.


You now know why the order matters: the backend project supplies both the code and the npm instructions that make npm install and npm run dev meaningful. Obtain the real project folder first, locate its backend directory, and confirm that package.json is inside it.

Next, you will verify whether Node.js and npm are available in Windows PowerShell using version commands.

Can't find a good explanation? Sign up and we'll make it for you

Sign up