Command Not Found
After installing, cortex-tms command doesn’t work
This guide covers common problems encountered when installing and initializing Cortex TMS. Whether you’re facing npm installation failures, permission errors, or platform-specific issues, this page provides step-by-step solutions.
Command Not Found
After installing, cortex-tms command doesn’t work
Permission Errors
EACCES errors during npm install or init
Node Version Issues
Node.js version too old or incompatible
Init Failures
cortex-tms init fails or produces incomplete files
cortex-tms: command not foundAfter running npm install -g cortex-tms, the command is not recognized:
$ cortex-tms --versioncortex-tms: command not foundOr on Windows:
$ cortex-tms --version'cortex-tms' is not recognized as an internal or external commandThe global npm bin directory is not in your system’s PATH environment variable. When npm installs global packages, it places executables in a specific directory that must be in PATH for the shell to find them.
Step 1: Find npm’s global bin directory
npm config get prefixExpected output:
/usr/localThe global executables are in <prefix>/bin. For example: /usr/local/bin
Step 2: Check if directory is in PATH
echo $PATH | grep -o '/usr/local/bin'If nothing is returned, the directory is NOT in PATH.
Step 3: Add to PATH
# Add to ~/.bashrc or ~/.bash_profileecho 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc
# Reload shell configurationsource ~/.bashrc# Add to ~/.zshrcecho 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc
# Reload shell configurationsource ~/.zshrc# Add to ~/.config/fish/config.fishecho 'set -gx PATH /usr/local/bin $PATH' >> ~/.config/fish/config.fish
# Reload shell configurationsource ~/.config/fish/config.fishStep 4: Verify
cortex-tms --versionExpected output:
2.6.0Step 1: Find npm’s global directory
npm config get prefixExpected output:
C:\Users\YourName\AppData\Roaming\npmStep 2: Add to PATH
Option A: Using System Settings (GUI)
C:\Users\YourName\AppData\Roaming\npmOption B: Using PowerShell (Admin)
# Get current npm prefix$npmPrefix = npm config get prefix
# Add to user PATH[Environment]::SetEnvironmentVariable( "Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";$npmPrefix", "User")Step 3: Restart terminal and verify
# Close and reopen PowerShellcortex-tms --versionExpected output:
2.6.0If you’re using pnpm instead of npm:
# Install globally with pnpmpnpm add -g cortex-tms
# Find pnpm global bin directorypnpm bin -gExpected output:
/Users/yourname/.local/share/pnpmAdd pnpm bin to PATH:
# Bash/Zshecho 'export PATH="$HOME/.local/share/pnpm:$PATH"' >> ~/.zshrcsource ~/.zshrc
# Verifycortex-tms --versionIf you’re using Yarn instead of npm:
# Install globally with Yarnyarn global add cortex-tms
# Find Yarn global bin directoryyarn global binExpected output:
/usr/local/binAdd Yarn bin to PATH:
# Bash/Zshecho 'export PATH="$(yarn global bin):$PATH"' >> ~/.zshrcsource ~/.zshrc
# Verifycortex-tms --versionUse a Node.js version manager (nvm, fnm, or asdf) to automatically manage PATH:
# Install nvmcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install Node.js with nvmnvm install 20nvm use 20
# Now npm global installs automatically worknpm install -g cortex-tmsInstallation or initialization fails with permission errors:
$ npm install -g cortex-tmsnpm ERR! code EACCESnpm ERR! syscall mkdirnpm ERR! path /usr/local/lib/node_modules/cortex-tmsnpm ERR! errno -13npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/cortex-tms'Or during cortex-tms init:
$ cortex-tms initError: EACCES: permission denied, open '/path/to/project/CLAUDE.md'Cause 1: npm global directory requires sudo
On some systems (especially Linux), npm’s global directory is owned by root, requiring sudo for installation. This is a security risk.
Cause 2: File system permissions
During cortex-tms init, the CLI cannot write files due to directory permissions.
Option A: Change npm’s default directory (safest)
This avoids needing sudo for global npm installs:
# Create a directory for global packagesmkdir -p ~/.npm-global
# Configure npm to use this directorynpm config set prefix '~/.npm-global'
# Add to PATHecho 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrcsource ~/.bashrc
# Now install without sudonpm install -g cortex-tmsOption B: Fix ownership of existing directory
# Find npm's global directorynpm config get prefix# Fix ownership (replace 'youruser' with your username)sudo chown -R $(whoami) /usr/local/lib/node_modulessudo chown -R $(whoami) /usr/local/bin
# Now install without sudonpm install -g cortex-tmsOption C: Use a Node version manager (best long-term)
# Install nvm (Node Version Manager)curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Reload shellsource ~/.bashrc
# Install Node.js via nvmnvm install 20nvm use 20
# Now npm installs work without sudonpm install -g cortex-tmsIf cortex-tms init fails due to file permissions:
# Check directory permissionsls -ld .
# Output example:# drwxr-xr-x 10 root staff 320 Jan 15 10:00 .# ❌ Owned by root (bad)
# Fix: Change ownership to your usersudo chown -R $(whoami) .
# Verifyls -ld .# drwxr-xr-x 10 youruser staff 320 Jan 15 10:00 .# ✅ Owned by youruser (good)
# Try init againcortex-tms initOn Windows, permission errors are usually due to:
Fix:
Option A: Run PowerShell as Administrator
npm install -g cortex-tmsOption B: Disable antivirus temporarily
Option C: Add npm folder to exclusions
C:\Users\YourName\AppData\Roaming\npm⚠️ Warning: Using sudo with npm is a security risk. Only use as a last resort.
# Install with sudo (not recommended)sudo npm install -g cortex-tms
# Problem: Now cortex-tms runs as root# Files created by 'cortex-tms init' will be owned by root
# If you must use sudo, fix file ownership afterward:cortex-tms initsudo chown -R $(whoami) .Why this is bad:
Better solution: Use Option A or C from “Fix npm Permissions” tab.
Use a Node.js version manager from the start:
# Install fnm (Fast Node Manager)curl -fsSL https://fnm.vercel.app/install | bash
# Install Node.jsfnm install 20fnm use 20
# Global npm installs now work without sudonpm install -g cortex-tmsInstallation fails with errors about unsupported Node.js version:
$ npm install -g cortex-tmsnpm ERR! engine Unsupported enginenpm ERR! engine Not compatible with your version of Nodenpm ERR! notsup Required: {"node":">=18.0.0"}npm ERR! notsup Actual: {"node":"v16.14.0"}Or runtime errors:
$ cortex-tms --versionError: Unexpected token '?'Cortex TMS requires Node.js 18.0.0 or higher. Older Node versions lack modern JavaScript features used by the CLI.
Step 1: Install nvm
# Install nvmcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Reload shellsource ~/.bashrc # or ~/.zshrcStep 2: Install Node.js 20 (LTS)
# Install latest LTS versionnvm install 20
# Set as defaultnvm alias default 20
# Verifynode --version# Output: v20.10.0Step 3: Install cortex-tms
npm install -g cortex-tmscortex-tms --version# Output: 2.6.0fnm is faster than nvm and supports multiple shells:
# Install fnmcurl -fsSL https://fnm.vercel.app/install | bash
# Reload shellsource ~/.bashrc # or ~/.zshrc
# Install Node.js 20fnm install 20fnm use 20
# Verifynode --version# Output: v20.10.0
# Install cortex-tmsnpm install -g cortex-tmsmacOS:
# Using Homebrewbrew install node@20
# Link to systembrew link node@20
# Verifynode --versionUbuntu/Debian:
# Add NodeSource repositorycurl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
# Install Node.jssudo apt-get install -y nodejs
# Verifynode --versionWindows:
node --version# Output: v20.10.0If you can’t install Node.js globally, use Docker:
# Pull Node.js 20 imagedocker pull node:20
# Run cortex-tms in containerdocker run -it --rm -v $(pwd):/app -w /app node:20 bash
# Inside container:npm install -g cortex-tmscortex-tms initexit
# Files are created in your current directoryls -la CLAUDE.md NEXT-TASKS.mdCreate an alias for convenience:
# Add to ~/.bashrc or ~/.zshrcalias cortex-tms='docker run -it --rm -v $(pwd):/app -w /app node:20 npx cortex-tms'
# Now use normallycortex-tms --versioncortex-tms initAdd a .nvmrc file to your project to pin the Node version:
# Create .nvmrcecho "20" > .nvmrc
# Now anyone on the team can run:nvm install # Installs version from .nvmrcnvm use # Switches to version from .nvmrccortex-tms init FailsRunning cortex-tms init produces errors or incomplete files:
$ cortex-tms initError: ENOENT: no such file or directory, scandir '/usr/local/lib/node_modules/cortex-tms/templates'Or:
$ cortex-tms init
🧠 Cortex TMS Initialization
✓ Project context detected✗ Failed to copy templates❌ Error: Template file not foundCause 1: Corrupted installation
The cortex-tms package was installed incompletely, missing template files.
Cause 2: Git not installed
cortex-tms init requires git for repository detection.
Cause 3: Non-interactive environment
Running in CI/CD or non-TTY environment without --force flag.
Step 1: Uninstall completely
# Uninstallnpm uninstall -g cortex-tms
# Clear npm cachenpm cache clean --force
# Verify removalwhich cortex-tms# Output: (nothing - command not found)Step 2: Reinstall
# Reinstall from npm registrynpm install -g cortex-tms@latest
# Verify installationcortex-tms --version# Output: 2.6.0Step 3: Test templates exist
# Find cortex-tms installation directorynpm list -g cortex-tms
# Check templates directory existsls -la /usr/local/lib/node_modules/cortex-tms/templates/
# Expected output:# drwxr-xr-x 8 user staff 256 Jan 15 10:00 .# -rw-r--r-- 1 user staff 2048 Jan 15 10:00 CLAUDE.md# -rw-r--r-- 1 user staff 1024 Jan 15 10:00 NEXT-TASKS.md# ...Step 4: Try init again
cd your-projectcortex-tms initcortex-tms init detects if the project is a git repository. Git must be installed:
Check if Git is installed:
git --versionIf not installed:
# Using Homebrewbrew install git
# Or install Xcode Command Line Toolsxcode-select --installsudo apt-get updatesudo apt-get install gitgit --versionInitialize Git repository (if needed):
# Initialize git in your projectgit init
# Try cortex-tms init againcortex-tms initIf running in CI/CD or a non-interactive environment:
# Use --force and --scope flags to skip promptscortex-tms init --scope standard --force
# Or for minimal setup:cortex-tms init --scope nano --force
# Enterprise setup:cortex-tms init --scope enterprise --forceExample CI/CD usage (GitHub Actions):
name: Initialize Cortex TMS
on: [push]
jobs: init-tms: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3
- name: Setup Node.js uses: actions/setup-node@v3 with: node-version: 20
- name: Install cortex-tms run: npm install -g cortex-tms
- name: Initialize TMS run: cortex-tms init --scope standard --force
- name: Commit TMS files run: | git config user.name "GitHub Actions" git config user.email "[email protected]" git add . git commit -m "chore: initialize Cortex TMS" git pushIf init fails because TMS files already exist:
$ cortex-tms init
⚠️ Warning: 3 TMS file(s) already exist: - CLAUDE.md - NEXT-TASKS.md - .cortexrc
Use --force to overwrite, or remove existing files first.Option A: Use —force to overwrite
cortex-tms init --force# ⚠️ This will overwrite existing TMS files!Option B: Back up and remove existing files
# Back up existing filesmkdir tms-backupmv CLAUDE.md NEXT-TASKS.md .cortexrc tms-backup/
# Initialize freshcortex-tms init
# Manually merge changes if neededOption C: Migrate existing setup
# If you have an older TMS setup, migrate:cortex-tms migrate
# This updates files to latest formatAdd a check to your project setup script:
#!/bin/bash# Check Node.js versionNODE_VERSION=$(node --version | cut -d'v' -f2 | cut -d'.' -f1)if [ "$NODE_VERSION" -lt 18 ]; then echo "Error: Node.js 18+ required (found: $(node --version))" exit 1fi
# Check Git installedif ! command -v git &> /dev/null; then echo "Error: Git not installed" exit 1fi
# Initialize Git if neededif [ ! -d .git ]; then git initfi
# Initialize Cortex TMScortex-tms init --scope standard
echo "✅ Project initialized successfully"Mixing npm, pnpm, and yarn causes installation issues:
$ npm install -g cortex-tms# Works
$ pnpm add -g cortex-tms# Installs to different location
$ cortex-tms --versioncortex-tms: command not foundEach package manager (npm, pnpm, yarn) installs global packages to different directories:
/usr/local/lib/node_modules/~/.local/share/pnpm/~/.yarn/bin/If your PATH includes one but not others, commands may not be found.
Choose ONE package manager and stick with it:
# Uninstall from all package managersnpm uninstall -g cortex-tms 2>/dev/nullpnpm remove -g cortex-tms 2>/dev/nullyarn global remove cortex-tms 2>/dev/null
# Install with npmnpm install -g cortex-tms
# Verifywhich cortex-tms# Output: /usr/local/bin/cortex-tms# Uninstall from other package managersnpm uninstall -g cortex-tms 2>/dev/nullyarn global remove cortex-tms 2>/dev/null
# Install with pnpmpnpm add -g cortex-tms
# Add pnpm bin to PATH (if not already)pnpm setup
# Verifywhich cortex-tms# Output: ~/.local/share/pnpm/cortex-tms# Uninstall from other package managersnpm uninstall -g cortex-tms 2>/dev/nullpnpm remove -g cortex-tms 2>/dev/null
# Install with Yarnyarn global add cortex-tms
# Add Yarn bin to PATH (if not already)echo 'export PATH="$(yarn global bin):$PATH"' >> ~/.zshrcsource ~/.zshrc
# Verifywhich cortex-tms# Output: ~/.yarn/bin/cortex-tmsAdd package manager enforcement to your project:
{ "engines": { "node": ">=18.0.0", "npm": ">=9.0.0" },}Or use Corepack (built into Node.js 16+):
# Enable Corepackcorepack enable
# Prepare pnpmcorepack prepare pnpm@latest --activate
# Now 'pnpm' is available, locked to version in package.jsonCortex TMS behaves differently on Windows:
\ vs /) cause errors.cursorrules → CLAUDE.md)Windows uses different conventions than Unix-like systems (macOS, Linux).
cortex-tms handles path separators automatically. If you see errors:
Error: ENOENT: no such file or directory, open 'docs\core\PATTERNS.md'Fix: Use forward slashes in .cortexrc:
{ "version": "1.0.0", "scope": "standard", "paths": { "docs": "docs/core", "tasks": "NEXT-TASKS.md", "archive": "docs/archive" }}cortex-tms will convert paths to the correct format automatically.
Windows uses CRLF (\r\n), Unix uses LF (\n). This affects file size validation.
Fix: Configure Git to normalize line endings
Create .gitattributes in project root:
* text=auto
# Specific files always use LF*.md text eol=lf*.json text eol=lf*.ts text eol=lf*.js text eol=lf
# Binary files*.png binary*.jpg binaryRe-normalize existing files:
# Remove all files from Git cachegit rm --cached -r .
# Re-add with new settingsgit reset --hardConfigure your editor:
VS Code: Add to .vscode/settings.json:
{ "files.eol": "\n"}Windows symlinks require administrator privileges or Developer Mode.
Option A: Enable Developer Mode (Windows 10/11)
# Create symlink from .cursorrules to CLAUDE.mdNew-Item -ItemType SymbolicLink -Path .cursorrules -Target CLAUDE.mdOption B: Copy instead of symlink
# Copy CLAUDE.md to .cursorrulesCopy-Item CLAUDE.md .cursorrules
# ⚠️ Remember to update both files when editingOption C: Use Git symlinks (if using Git Bash)
# In Git Bash:ln -s CLAUDE.md .cursorrules
# Enable symlinks in Gitgit config core.symlinks truePowerShell may block cortex-tms scripts:
cortex-tms : File C:\Users\YourName\AppData\Roaming\npm\cortex-tms.ps1 cannot be loaded becauserunning scripts is disabled on this system.Fix: Change execution policy
# Check current policyGet-ExecutionPolicy
# Output: Restricted (blocks all scripts)
# Allow scripts (run as Administrator)Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
# VerifyGet-ExecutionPolicy# Output: RemoteSigned
# Try cortex-tms againcortex-tms --versionExecution policy levels:
Restricted: No scripts allowed (default)RemoteSigned: Local scripts allowed, downloaded scripts require signatureUnrestricted: All scripts allowed (not recommended)Add Windows-specific configuration to your project:
{ "files.eol": "\n", "files.trimTrailingWhitespace": true, "files.insertFinalNewline": true}* text=auto eol=lf*.md text eol=lf*.json text eol=lfInstallation fails in corporate environments:
$ npm install -g cortex-tmsnpm ERR! network request to https://registry.npmjs.org/cortex-tms failed, reason: connect ETIMEDOUTnpm ERR! network This is a problem related to network connectivity.Corporate firewalls or proxies block npm registry access.
Step 1: Get proxy settings from IT
Ask your IT department for:
http://proxy.company.com:8080)Step 2: Configure npm
# Set HTTP proxynpm config set proxy http://proxy.company.com:8080
# Set HTTPS proxynpm config set https-proxy http://proxy.company.com:8080
# If authentication required:Step 3: Verify settings
npm config get proxynpm config get https-proxyStep 4: Try installation
npm install -g cortex-tmsSome companies host an internal npm registry (Artifactory, Verdaccio):
# Set registry to company mirrornpm config set registry https://npm.company.com/
# Install from company registrynpm install -g cortex-tmsIf cortex-tms isn’t in company registry:
Ask IT to add cortex-tms to the allowlist, or:
# Temporarily use public registry for one packagenpm install -g cortex-tms --registry https://registry.npmjs.org/
# Reset to company registrynpm config set registry https://npm.company.com/If all else fails, download and install manually:
Step 1: Download tarball
On a machine with internet access:
# Download cortex-tms tarballnpm pack cortex-tms
# Output: cortex-tms-2.6.0.tgzStep 2: Transfer to corporate machine
Copy cortex-tms-2.6.0.tgz to your corporate machine (USB, email, etc.)
Step 3: Install from tarball
# Install from local filenpm install -g ./cortex-tms-2.6.0.tgz
# Verifycortex-tms --version⚠️ Security Warning: Only use as a last resort.
# Disable SSL verification (NOT recommended)npm config set strict-ssl false
# Install packagenpm install -g cortex-tms
# Re-enable SSL verificationnpm config set strict-ssl trueWhy this is risky:
Better solution: Ask IT to add npm registry to SSL certificate allowlist.
Create a project .npmrc file:
registry=https://npm.company.com/proxy=http://proxy.company.com:8080https-proxy=http://proxy.company.com:8080strict-ssl=trueAdd to .gitignore if it contains credentials:
.npmrcBefore asking for help, run through this checklist:
node --version)npm --version)cortex-tms --version)which cortex-tms or where cortex-tms)git --version)touch test.txt && rm test.txt)ping registry.npmjs.org)If all checks pass but issues persist, see Getting Help.
Now that installation issues are resolved:
cortex-tms validate failures