Forgejo and Gitea Actions: "Cannot find: node in PATH"
The step runs a JavaScript action, and the place where the step runs has no node. The Forgejo documentation says that many common actions, for example actions/checkout, need Node.js in the image. The Gitea documentation lists node as needed for JavaScript actions wherever steps run, in the job image or on the host. Run the job in an image that contains Node.js, or install Node.js on the host if the label is a host label.
What the sources say
- Forgejo documentation, runner configuration (forgejo.org/docs): "Many common actions (for example,
uses: actions/checkout@v7) require Node.js in the image." The same page gives the labelubuntu-latest:docker://node:ltsas the way to mimic GitHub runners. - Gitea documentation, runner (docs.gitea.com): jobs need
bashorshforrunsteps andnodefor JavaScript actions andhashFiles(), wherever steps run. Container labels (docker://IMAGE) run steps in the image; the labelhostruns them directly on the runner's machine.
To see which runner a queued job waits for: Pipeline Inbox for Forgejo and Gitea, a plugin for JetBrains IDEs, marks a job that waits for a runner as queued, keeps its log open so the first lines appear as soon as a runner takes it, and from version 1.0.1 shows the labels it asks for in runs-on.
The cases in the Gitea forum
The message is in the thread Gitea actions: "Cannot find: node in PATH" on forum.gitea.com. The log lines there:
| Cannot find: node in PATH [compile/Explore-Gitea-Actions] ❌ Failure - Main Check out repository code
- Host mode on Windows: the workflow had
runs-on: windowsanduses: actions/checkout@v3. The reply says the default container image includes Node.js, but in host mode Node.js has to be installed on the host. - The Docker image of the runner: a poster in the same thread reports the same error and a fix with
apk add --no-cache nodejs. - Docker Compose with
runs-on: ubuntu-latest: a poster reports a different line,OCI runtime exec failed: exec failed: unable to start container process: exec: "node": executable file not found in $PATH: unknown. Installing Node.js into the runner's own container did not help. The cause that poster found was the labels in the runner's.runnerfile; replacing them with the labels from the Gitea documentation fixed it. A later reply says the Gitea documentation then suggested Node 16, while Node 20 had been the default since act_runner 0.2.9.
Check and fix
- Find out where the step runs. The label of the runner that took the job, the part after the colon, tells it:
docker://IMAGEis a container,hostis the runner's machine (Gitea labels, Forgejo configuration). - Add a step before the failing one to see what the place has:
- run: node --version
If that step fails too, the place has nonode. - Container label: use an image that has Node.js in the label. The Forgejo documentation gives
ubuntu-latest:docker://node:lts; the Gitea documentation showsgitea-runner config set runner.labels 'ubuntu-latest:docker://node:24' 'macos:host'. Changing labels needs a restart of the runner (Gitea documentation). In Forgejo the labels are underrunner: labels:in the configuration file of the runner. - Host label: install Node.js on the machine of the runner and make sure it is in the
PATHof the account the runner runs as. The Forgejo documentation warns that host mode has no isolation: "a single job can permanently destroy the host." - If the label is an image that already has Node.js and the error stays, compare the labels in the runner's registration and configuration with the ones in the documentation, as in the Docker Compose case above.
Forgejo and Gitea Actions in IntelliJ IDEA
Pipeline Inbox for Forgejo and Gitea, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, shows the runs of your Forgejo and Gitea repositories with their jobs and logs. A job that waits for a runner is marked queued in the jobs of its run, and its log stays open and follows it, so the first lines appear as soon as a runner takes the job. Since version 1.0.1 it also shows the labels the waiting job asks for (its runs-on). The runs, jobs and logs are free; re-running, cancelling and starting workflows are Pro (US$1.50 a month, with a 30-day trial).
Get it on JetBrains Marketplace
Forgejo, Gitea and Codeberg are names of their respective owners; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by the Forgejo project, Codeberg e.V., the Gitea project or JetBrains.
More: No matching online runner with label · actions/checkout "Not found." · Job stuck at "Set up job" · Workflow dispatch refused · Job log expired · Forgejo Actions and Gitea Actions in JetBrains IDEs · 日本語