django-tailwind cannot find the npm executable (cPanel, Windows, Linux)
python manage.py tailwind install fails because npm or Node.js cannot be foundShort answer
django-tailwind runs npm as a subprocess, and Python sometimes cannot find it. Set NPM_BIN_PATH in settings.py to the full path of npm (npm.cmd on Windows). Make sure Node.js is version 22 or newer. On shared hosting without Node.js, run tailwind build elsewhere and deploy the CSS.
Fix it fast
1Find out which cause you have
Ask the same environment that runs Django where npm is. If this prints nothing, Python cannot see npm either, and the first cause applies.
which npm node --version2Match what you see, then jump to its fix
- 1
npm works in your terminal, but the manage.py command cannot find it (the docs name Windows as the common case)Python cannot find npm, so NPM_BIN_PATH is neededFix - 2
npm cannot be found at all, or node --version prints a version below 22Node.js is missing or older than the version Tailwind needsFix - 3
Shared hosting where you cannot install Node.js, and tailwind commands are only needed to produce CSSThe server has no Node.js at all, so build the CSS elsewhereFix
- 1
What does the error look like?
python manage.py tailwind install fails because npm or Node.js cannot be foundCommandError raised by the tailwind management command about npm
Cause 1 of 3
Python cannot find npm, so NPM_BIN_PATH is needed
1Check
The package docs say the Python executable sometimes cannot find the npm binary, especially on Windows. On Windows, npm may be on PATH as npm.cmd rather than npm. To get the path use which npm (Linux or macOS), or where npm or Get-Command npm on Windows.
which npm2Fix
Set NPM_BIN_PATH in settings.py. A fully qualified path is the most reliable form.
# settings.py (Linux / macOS)
NPM_BIN_PATH = "/usr/local/bin/npm"
# settings.py (Windows)
NPM_BIN_PATH = r"C:\Program Files\nodejs\npm.cmd"3Verify
Run the install command again.
python manage.py tailwind installConfirmed by django-tailwind.readthedocs.io
Cause 2 of 3
Node.js is missing or older than the version Tailwind needs
1Check
For npm-based installs the package docs say Tailwind CSS requires Node.js 22 or newer on the machine. On cPanel, the Application Manager page lists the Node.js packages ea-nodejs16, 18, 20 and 22, and installing one removes the other Node.js packages.
node --version2Fix
Install Node.js 22 or newer (on cPanel, the ea-nodejs22 package, if your host allows it), then set NPM_BIN_PATH to the npm that belongs to it.
node --version
which npm3Verify
Install the dependencies and start the watcher.
python manage.py tailwind install
python manage.py tailwind startConfirmed by docs.cpanel.net
Cause 3 of 3
The server has no Node.js at all, so build the CSS elsewhere
1Check
The usage page says python manage.py tailwind build replaces the development build with a production-optimised CSS bundle, and that no further action is needed before you deploy.
python manage.py tailwind build2Fix
Run the build on your own machine (or in CI) where Node.js 22 is installed, then deploy the generated CSS with the rest of the project. The live server then only runs Django.
# on the machine with Node.js
python manage.py tailwind install
python manage.py tailwind build3Verify
Open the deployed page and confirm the Tailwind styles load.
curl -I https://example.com/Confirmed by django-tailwind.readthedocs.io
How do I stop it coming back?
- Pin the Node.js major version for the project (in your docs or CI) so every machine matches.
- Set NPM_BIN_PATH from an environment variable in settings.py so dev, CI and server can each point to their own npm.
- Run tailwind build in the deploy pipeline instead of on the live host.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- WorkforceA field app, an admin console and a self-hosted Node.js server for push and reconciliation.
- stegnor.comMy company site: 804 pages from a Python and Jinja generator, with 15 free browser tools.
Related fixes
Web apps
CORS fails when you open an HTML file straight from disk
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///
A page opened from disk has an opaque origin, so browsers treat every request it makes as cross-origin, and CORS only works over http or https.
3 causes, each with a fixWeb apps
npm start runs, but the browser does not refresh when you save a file
Saving a file does nothing while npm start is running
The watcher behind npm start is not seeing your edit.
4 causes, each with a fixWeb apps
Node.js fails with uv_cwd ENOENT when its folder is gone
npm, node or next fails at start in a terminal whose folder was removed
uv_cwd is how Node.js asks the operating system for its current working directory.
2 causes, each with a fixWeb apps
Playwright cannot open a headed browser on a Linux server or in Docker
npx playwright test --headed shows no window on a Linux server
A headed browser needs a display, and a Linux server or container has none.
3 causes, each with a fixWeb apps
The shell says pnpm: command not found
npx next dev works, but pnpm dev or pnpm install is not found
The shell cannot find a pnpm executable on PATH.
3 causes, each with a fixWeb apps
Vite build stops with [vite:load-fallback] Could not load a file
ENOENT: no such file or directory
The message names two files: the one Vite could not read and the file that imports it.
2 causes, each with a fix