Node.js / npm

npx: command not found

Covers: npx command not found after Node.js install, nvm issues, and missing PATH — May 2026

🐧 Linux 🍎 macOS 🪟 Windows 📦 nvm
$ npx create-react-app my-app
bash: npx: command not found

# or:
zsh: command not found: npx

Why Does This Happen?

npx ships bundled with npm 5.2.0 and later (Node.js 8.2.0+). If you're getting this error, one of the following is true:

⚡ Quick Fix — Update Node.js (recommended)

# Install nvm (Node Version Manager): curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash # Reload shell: source ~/.bashrc # or ~/.zshrc # Install latest LTS Node (includes npx): nvm install --lts nvm use --lts # Verify: node --version && npm --version && npx --version

Fix on Ubuntu/Debian (apt installs outdated Node)

The Node.js version in Ubuntu's default apt repos is often very old. Use the NodeSource PPA for a current version:

# Add NodeSource repo (Node 20 LTS): curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt-get install -y nodejs # npx is now included: npx --version

nvm: npx Works in One Session But Not Another

With nvm, you need to call nvm use in each new terminal session unless you set a default:

# Set default Node version for all new sessions: nvm alias default lts/* # Or set a specific version: nvm alias default 20

npm Installed But npx Missing

# Update npm (includes npx): npm install -g npm@latest # If npx still missing, install it explicitly: npm install -g npx