Skip to content

Running Open-source Models projects locally

Use this page to run either extracted Open-source Models project. One loads a Transformers.js model in your browser; the other runs an Express server that calls Ollama on your computer. Identify which project you have, then follow only that setup.

What you need first

Install a supported LTS version of Node.js. Node 24 is recommended and includes npm. If Node and npm are new to you, Running the code locally walks through installing and checking both.

The Transformers.js project needs a current browser, an internet connection for its first library and model download, and enough browser storage and memory for the model. It does not need an API key.

The Ollama project also needs Ollama, enough disk space and memory for the mistral model, and its local Ollama service running. It does not need a provider account or API key.

JunoWhat you need first Install Node.js LTS first, then pick the setup for your project: a current browser and an internet connection for Transformers.js, or the Ollama app with its service left running for the Ollama lesson.

Neither setup needs an API key, so there is no key to create here.

JunoWhat you need first Both projects run the model on your own hardware, so there is no provider key to configure. Transformers.js downloads the model into the browser tab; the Ollama lesson needs the separate Ollama service installed and running before its server can reach it.

Install Node LTS either way, because npm drives both setups.

JunoWhat you need first Two ways to compute locally means two resource budgets. The browser setup depends on remote library and model files plus browser cache, storage, and memory; the Ollama setup needs the native service, downloaded model weights, and enough free memory and processor capacity for inference.

Check that your machine can hold the model before you start.

Identify the project you extracted

Open a terminal in the extracted folder containing package.json:

bash
$ cd path-to-your-downloaded-project

If the folder name does not tell you which lesson you extracted, open index.js. An express import means the Ollama lesson, which needs the package repair below. An import of @xenova/transformers from jsDelivr means the browser app, which runs without any changes.

JunoIdentify the project you extracted Open your terminal in the folder that contains package.json, and check where you are before running anything.

Then look at the top of index.js: express sends you to the Ollama section, Transformers.js sends you to the browser section.

JunoIdentify the project you extracted The two downloads look alike from the outside but run differently: the browser-model project starts with Vite, while the Ollama project is a Node server that also needs the separate Ollama service.

Pick the section that matches yours and follow only that one, because the setup steps do not mix.

JunoIdentify the project you extracted Identify the project from its imports, not the folder name. Both ZIPs ship a Vite-shaped package.json, so only index.js tells them apart.

Applying the Ollama repair to the browser project would replace a working Vite start script with a Node one that cannot serve the page.

Run the Transformers.js project

Use these instructions for AI Models In The Browser With Transformers.js. This project needs Node and npm for Vite.

Install and start it:

bash
$ npm install
$ npm start

Open the Local URL Vite prints, usually http://localhost:5173/. The page first imports Transformers.js from jsDelivr and then downloads the Xenova/yolos-tiny object-detection model. Wait until its status changes from Loading model... to Ready before selecting Detect Objects; the button stays disabled until then.

The first load needs an internet connection and can take longer than an ordinary frontend page. Browser caching can make later loads faster. If the status never reaches Ready, open the DevTools Network tab: a blocked jsDelivr request points to a CDN or content-blocker problem, while a slowly growing model file means the weights download is still in progress. Stop Vite with Ctrl+C.

No provider credential is needed

The model executes in your browser rather than through a hosted inference API. There is no .env file or API key to configure for this lesson.

JunoRun the Transformers.js project Run npm install, then npm start, open the Local URL, and wait for the status to read Ready before selecting anything.

The first model download is the slow one. If Ready never arrives, check the Network tab in DevTools.

JunoRun the Transformers.js project Three things load in order: Vite serves the page, jsDelivr supplies the library, and the model weights download into the browser to run there.

That first load is limited by your download speed, so a slow status usually means a download still in progress rather than a bug.

JunoRun the Transformers.js project The page can open before the model is ready, because index.js awaits the pipeline at the top level before it enables the button.

When Ready never arrives, the Network tab names the request at fault: a blocked jsDelivr request points to a CDN or content blocker, a model file growing slowly points to a slow weights download.

Repair and run the Ollama project

Use these instructions for Download and Run AI Models on Your Computer with Ollama. The exported ZIP contains the lesson's Node code, but its generated package.json still describes a Vite project. It cannot run locally without a small package repair.

After installing Ollama, make sure its local service is running. Download the model named by the lesson code:

bash
$ ollama pull mistral
$ ollama ls

The second command should list mistral. Depending on your operating system, opening the Ollama application starts the service automatically. If it does not, run ollama serve in a separate terminal and leave it running.

In the extracted project, add "type": "module" as a top-level property of package.json, a sibling of "scripts":

json
{
  "type": "module",
  "scripts": {
    "start": "vite"
  }
}

Then change the start script from:

json
"start": "vite"

to:

json
"start": "node index.js"

Install the two dependencies imported by index.js:

bash
$ npm install express ollama
$ npm start

The server prints:

text
Server is running on port 3000

Test the route without invoking a model:

text
http://localhost:3000/

It should ask you to supply a question parameter. Then try a real local model request:

text
http://localhost:3000/?question=Why%20is%20the%20sky%20blue%3F

The Express server waits while Ollama loads the model and generates its reply. The first response can be noticeably slower. Stop Express with Ctrl+C. Stop a separately launched ollama serve process with Ctrl+C when you no longer need it.

No provider API key or .env file is required. The model weights and inference stay on the machine running Ollama.

JunoRepair and run the Ollama project Download the mistral model and keep Ollama running, then fix package.json: add the module type and point the start script at node index.js.

Install express and ollama, start the server, and ask it a question on port 3000. A slow first answer means the model is loading, not that anything broke.

JunoRepair and run the Ollama project Two processes cooperate here: Ollama serves the model and Express exposes the lesson route. The ZIP's package metadata was written for a Vite project, so the repair points it at the Node entry point and installs the two imported packages.

If a request hangs, check which of the two processes stopped.

JunoRepair and run the Ollama project The export describes the wrong kind of app, so both package edits are required: the module type lets Node load the ESM imports, and the start script runs index.js instead of Vite.

Even after the repair, Express only answers if Ollama runs separately with mistral already downloaded; the server never starts the model service for you.

Troubleshooting

The Transformers.js page stays on Loading model...: Check the browser console and the DevTools Network tab. Content blockers or a restricted network may block jsDelivr or the model download. Try a current browser with enough free storage and memory.

The Ollama project says Cannot find package 'express' or 'ollama': Run npm install express ollama in the folder containing package.json.

Node says Cannot use import statement outside a module: Add "type": "module" to package.json.

npm start launches Vite or complains about a missing index.html: Change the start script to node index.js. The Ollama lesson is a Node server, not a Vite page.

The route cannot connect to Ollama: Confirm the Ollama application or ollama serve is running, then use ollama ls to confirm the mistral model is installed.

Port 3000 is already in use: Stop the other process or change the port constant in index.js, restart Express, and open the matching URL.

JunoTroubleshooting Match the fix to the project: for Transformers.js, look at the browser's Network tab and Console; for Ollama, check the package repair, the installed model, the running service, and the port.

Most errors here come from one missed step.

JunoTroubleshooting Work out which runtime failed before changing anything: Vite and browser assets belong to the Transformers.js project, while Node, Express, and the Ollama service belong to the other.

A fix applied to the wrong project usually creates new errors.

JunoTroubleshooting For Transformers.js, the failure lives in downloads or browser memory. For Ollama, check the chain in order: Node accepts the module syntax, Express holds port 3000, the service is running, and mistral appears in ollama ls.

A later symptom is often the same earlier failure in a different form.