Skip to content

Installation Issues

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.

Quick Issue Navigator


Issue: cortex-tms: command not found

Symptoms

After running npm install -g cortex-tms, the command is not recognized:

Terminal window
$ cortex-tms --version
cortex-tms: command not found

Or on Windows:

Terminal window
$ cortex-tms --version
'cortex-tms' is not recognized as an internal or external command

Cause

The 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.

Solution

Step 1: Find npm’s global bin directory

Terminal window
npm config get prefix

Expected output:

/usr/local

The global executables are in <prefix>/bin. For example: /usr/local/bin

Step 2: Check if directory is in PATH

Terminal window
echo $PATH | grep -o '/usr/local/bin'

If nothing is returned, the directory is NOT in PATH.

Step 3: Add to PATH

Terminal window
# Add to ~/.bashrc or ~/.bash_profile
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc
# Reload shell configuration
source ~/.bashrc

Step 4: Verify

Terminal window
cortex-tms --version

Expected output:

2.6.0

Prevention

Use a Node.js version manager (nvm, fnm, or asdf) to automatically manage PATH:

Terminal window
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install Node.js with nvm
nvm install 20
nvm use 20
# Now npm global installs automatically work
npm install -g cortex-tms

Issue: Permission Denied (EACCES)

Symptoms

Installation or initialization fails with permission errors:

Terminal window
$ npm install -g cortex-tms
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/cortex-tms
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/cortex-tms'

Or during cortex-tms init:

Terminal window
$ cortex-tms init
Error: EACCES: permission denied, open '/path/to/project/CLAUDE.md'

Cause

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.

Solution

Option A: Change npm’s default directory (safest)

This avoids needing sudo for global npm installs:

Terminal window
# Create a directory for global packages
mkdir -p ~/.npm-global
# Configure npm to use this directory
npm config set prefix '~/.npm-global'
# Add to PATH
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
# Now install without sudo
npm install -g cortex-tms

Option B: Fix ownership of existing directory

/usr/local
# Find npm's global directory
npm config get prefix
# Fix ownership (replace 'youruser' with your username)
sudo chown -R $(whoami) /usr/local/lib/node_modules
sudo chown -R $(whoami) /usr/local/bin
# Now install without sudo
npm install -g cortex-tms

Option C: Use a Node version manager (best long-term)

Terminal window
# Install nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Reload shell
source ~/.bashrc
# Install Node.js via nvm
nvm install 20
nvm use 20
# Now npm installs work without sudo
npm install -g cortex-tms

Prevention

Use a Node.js version manager from the start:

Terminal window
# Install fnm (Fast Node Manager)
curl -fsSL https://fnm.vercel.app/install | bash
# Install Node.js
fnm install 20
fnm use 20
# Global npm installs now work without sudo
npm install -g cortex-tms

Issue: Node Version Incompatibility

Symptoms

Installation fails with errors about unsupported Node.js version:

Terminal window
$ npm install -g cortex-tms
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of Node
npm ERR! notsup Required: {"node":">=18.0.0"}
npm ERR! notsup Actual: {"node":"v16.14.0"}

Or runtime errors:

Terminal window
$ cortex-tms --version
Error: Unexpected token '?'

Cause

Cortex TMS requires Node.js 18.0.0 or higher. Older Node versions lack modern JavaScript features used by the CLI.

Solution

Step 1: Install nvm

Terminal window
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Reload shell
source ~/.bashrc # or ~/.zshrc

Step 2: Install Node.js 20 (LTS)

Terminal window
# Install latest LTS version
nvm install 20
# Set as default
nvm alias default 20
# Verify
node --version
# Output: v20.10.0

Step 3: Install cortex-tms

Terminal window
npm install -g cortex-tms
cortex-tms --version
# Output: 2.6.0

Prevention

Add a .nvmrc file to your project to pin the Node version:

Terminal window
# Create .nvmrc
echo "20" > .nvmrc
# Now anyone on the team can run:
nvm install # Installs version from .nvmrc
nvm use # Switches to version from .nvmrc

Issue: cortex-tms init Fails

Symptoms

Running cortex-tms init produces errors or incomplete files:

Terminal window
$ cortex-tms init
Error: ENOENT: no such file or directory, scandir '/usr/local/lib/node_modules/cortex-tms/templates'

Or:

Terminal window
$ cortex-tms init
🧠 Cortex TMS Initialization
Project context detected
Failed to copy templates
Error: Template file not found

Cause

Cause 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.

Solution

Step 1: Uninstall completely

Terminal window
# Uninstall
npm uninstall -g cortex-tms
# Clear npm cache
npm cache clean --force
# Verify removal
which cortex-tms
# Output: (nothing - command not found)

Step 2: Reinstall

Terminal window
# Reinstall from npm registry
npm install -g cortex-tms@latest
# Verify installation
cortex-tms --version
# Output: 2.6.0

Step 3: Test templates exist

/usr/local/lib/node_modules/cortex-tms
# Find cortex-tms installation directory
npm list -g cortex-tms
# Check templates directory exists
ls -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

Terminal window
cd your-project
cortex-tms init

Prevention

Add a check to your project setup script:

setup.sh
#!/bin/bash
# Check Node.js version
NODE_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 1
fi
# Check Git installed
if ! command -v git &> /dev/null; then
echo "Error: Git not installed"
exit 1
fi
# Initialize Git if needed
if [ ! -d .git ]; then
git init
fi
# Initialize Cortex TMS
cortex-tms init --scope standard
echo "✅ Project initialized successfully"

Issue: Package Manager Conflicts

Symptoms

Mixing npm, pnpm, and yarn causes installation issues:

Terminal window
$ npm install -g cortex-tms
# Works
$ pnpm add -g cortex-tms
# Installs to different location
$ cortex-tms --version
cortex-tms: command not found

Cause

Each package manager (npm, pnpm, yarn) installs global packages to different directories:

  • npm: /usr/local/lib/node_modules/
  • pnpm: ~/.local/share/pnpm/
  • yarn: ~/.yarn/bin/

If your PATH includes one but not others, commands may not be found.

Solution

Choose ONE package manager and stick with it:

Terminal window
# Uninstall from all package managers
npm uninstall -g cortex-tms 2>/dev/null
pnpm remove -g cortex-tms 2>/dev/null
yarn global remove cortex-tms 2>/dev/null
# Install with npm
npm install -g cortex-tms
# Verify
which cortex-tms
# Output: /usr/local/bin/cortex-tms

Prevention

Add package manager enforcement to your project:

package.json
{
"engines": {
"node": ">=18.0.0",
"npm": ">=9.0.0"
},
"packageManager": "[email protected]"
}

Or use Corepack (built into Node.js 16+):

Terminal window
# Enable Corepack
corepack enable
# Prepare pnpm
corepack prepare pnpm@latest --activate
# Now 'pnpm' is available, locked to version in package.json

Issue: Windows-Specific Problems

Symptoms

Cortex TMS behaves differently on Windows:

  • Path separators (\ vs /) cause errors
  • Line endings (CRLF vs LF) break file size validation
  • Symlinks don’t work (.cursorrulesCLAUDE.md)
  • PowerShell execution policy blocks scripts

Cause

Windows uses different conventions than Unix-like systems (macOS, Linux).

Solution

cortex-tms handles path separators automatically. If you see errors:

Terminal window
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.

Prevention

Add Windows-specific configuration to your project:

.vscode/settings.json
{
"files.eol": "\n",
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true
}
.gitattributes
* text=auto eol=lf
*.md text eol=lf
*.json text eol=lf

Issue: Proxy/Firewall Blocking npm

Symptoms

Installation fails in corporate environments:

Terminal window
$ npm install -g cortex-tms
npm ERR! network request to https://registry.npmjs.org/cortex-tms failed, reason: connect ETIMEDOUT
npm ERR! network This is a problem related to network connectivity.

Cause

Corporate firewalls or proxies block npm registry access.

Solution

Step 1: Get proxy settings from IT

Ask your IT department for:

  • Proxy URL (e.g., http://proxy.company.com:8080)
  • Authentication (username/password if required)

Step 2: Configure npm

Terminal window
# Set HTTP proxy
npm config set proxy http://proxy.company.com:8080
# Set HTTPS proxy
npm config set https-proxy http://proxy.company.com:8080
# If authentication required:
npm config set proxy http://username:[email protected]:8080
npm config set https-proxy http://username:[email protected]:8080

Step 3: Verify settings

Terminal window
npm config get proxy
npm config get https-proxy

Step 4: Try installation

Terminal window
npm install -g cortex-tms

Prevention

Create a project .npmrc file:

.npmrc
registry=https://npm.company.com/
proxy=http://proxy.company.com:8080
https-proxy=http://proxy.company.com:8080
strict-ssl=true

Add to .gitignore if it contains credentials:

.gitignore
.npmrc

Diagnostic Checklist

Before asking for help, run through this checklist:

  • Node.js version is 18.0.0 or higher (node --version)
  • npm is installed (npm --version)
  • cortex-tms is installed globally (cortex-tms --version)
  • cortex-tms bin is in PATH (which cortex-tms or where cortex-tms)
  • Git is installed (git --version)
  • Current directory is writable (touch test.txt && rm test.txt)
  • No permission errors when creating files
  • Network connectivity works (ping registry.npmjs.org)
  • No antivirus blocking npm

If all checks pass but issues persist, see Getting Help.


Next Steps

Now that installation issues are resolved: