Skip to main content

System Requirements

Node.js

Version 14.0.0 or higher

npm

Comes with Node.js

Operating System

Windows, macOS, or Linux

Disk Space

~50MB for installation

Installation Methods

  • npm (Global)
  • npx (No Install)
  • Project Dependency
  • Yarn
Install KafkaCode globally to use it anywhere on your system:
npm install -g kafkacode
Verify the installation:
kafkacode --version
Global installation is recommended if you plan to use KafkaCode across multiple projects.

Platform-Specific Instructions

First, ensure Node.js is installed:
brew install node
Then install KafkaCode:
npm install -g kafkacode

Permissions Issues?

If you encounter permission errors, use one of these solutions:Option 1: Use a version manager like nvm (recommended)
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

# Install Node.js
nvm install node

# Now install KafkaCode
npm install -g kafkacode
Option 2: Configure npm to use a different directory
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
source ~/.zshrc
npm install -g kafkacode

Ubuntu/Debian

# Install Node.js and npm
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs

# Install KafkaCode
sudo npm install -g kafkacode

Fedora/RHEL/CentOS

# Install Node.js and npm
curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
sudo yum install -y nodejs

# Install KafkaCode
sudo npm install -g kafkacode
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

# Restart your terminal or run:
source ~/.bashrc

# Install Node.js
nvm install node

# Install KafkaCode (no sudo needed)
npm install -g kafkacode
  1. Download Node.js from nodejs.org
  2. Run the installer (.msi file)
  3. Open Command Prompt or PowerShell
  4. Install KafkaCode:
npm install -g kafkacode

Using Windows Package Manager (winget)

# Install Node.js
winget install OpenJS.NodeJS

# Install KafkaCode
npm install -g kafkacode

Using Chocolatey

# Install Node.js
choco install nodejs

# Install KafkaCode
npm install -g kafkacode
On Windows, you may need to run your terminal as Administrator for global installations.

Verifying Installation

After installation, verify that KafkaCode is working correctly:
1

Check Version

kafkacode --version
Should output: 1.2.0 (or your installed version)
2

View Help

kafkacode --help
Should display the help menu with available commands
3

Run Test Scan

mkdir test-project
echo "const apiKey = 'AKIAIOSFODNN7EXAMPLE';" > test-project/test.js
kafkacode scan test-project
Should detect the AWS key and display a report

Updating KafkaCode

Keep KafkaCode up to date to get the latest features and security improvements:
npm update -g kafkacode

Uninstallation

If you need to remove KafkaCode:
npm uninstall -g kafkacode

Troubleshooting

If you get command not found: kafkacode after installation:
  1. Check your PATH includes npm’s global bin directory:
    npm config get prefix
    
  2. Add npm’s bin directory to your PATH:
    # For bash
    echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.bashrc
    source ~/.bashrc
    
    # For zsh
    echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.zshrc
    source ~/.zshrc
    
  3. Alternatively, use npx:
    npx kafkacode scan ./
    
If you encounter EACCES permission errors:
  1. Never use sudo with npm - This can cause permission issues
  2. Use nvm (Node Version Manager) instead:
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
    nvm install node
    npm install -g kafkacode
    
  3. Or configure npm to use a different directory (see platform-specific instructions)
If installation fails due to network issues:
  1. Configure npm proxy:
    npm config set proxy http://proxy.company.com:8080
    npm config set https-proxy http://proxy.company.com:8080
    
  2. Or disable SSL verification (not recommended for production):
    npm config set strict-ssl false
    
  3. Clear npm cache:
    npm cache clean --force
    npm install -g kafkacode
    
If you’re running an old version of Node.js:
  1. Check your current version:
    node --version
    
  2. KafkaCode requires Node.js 14.0.0 or higher
  3. Update Node.js:
    • Using nvm: nvm install node
    • Using package manager: Reinstall from nodejs.org

Next Steps