npm install -g @znemz/cfn-includeThat's it! The cfn, yml, and yaml commands are now available globally.
npm automatically creates symlinks in your PATH for:
cfn→ executable YAML wrapperyml→ alias to cfnyaml→ alias to cfncfn-include→ original CLI
which cfn yml yaml
# Should show paths like:
# /usr/local/bin/cfn
# /usr/local/bin/yml
# /usr/local/bin/yaml# Create a template
cat > my-stack.yaml << 'TEMPLATE'
#!/usr/bin/env yaml
Resources:
Bucket:
Type: AWS::S3::Bucket
TEMPLATE
# Make it executable
chmod +x my-stack.yaml
# Run it!
./my-stack.yaml # Preview
./my-stack.yaml --deploy # Deploy to AWSCause: npm bin directory not in PATH
Fix:
# Find npm bin directory
npm bin -g
# Example output: /usr/local/bin
# Add to PATH (in ~/.zshrc or ~/.bashrc)
export PATH="$(npm bin -g):$PATH"Cause: npm global install location not in PATH, or cfn not executable
Fix:
# Reinstall globally
npm install -g @znemz/cfn-include
# Verify cfn is executable
ls -la $(npm bin -g)/cfn
# Should show: lrwxr-xr-x ... /usr/local/bin/cfn -> ../lib/node_modules/@znemz/cfn-include/bin/cfnShebang (#!) is Unix/Linux/macOS only. On Windows:
Option 1: WSL (Recommended)
# Install in WSL
npm install -g @znemz/cfn-include
# Executable YAML works normally
chmod +x template.yaml
./template.yaml --deployOption 2: Direct CLI
# Use cfn-include directly (no shebang)
cfn-include template.yaml --deploySee examples/ directory:
executable-simple.yaml— Basic S3 bucketexecutable-template.yaml— Full auto-scaling web stack
Both are ready to run:
cd examples
./executable-simple.yamlnpm uninstall -g @znemz/cfn-includeThis removes all bin symlinks automatically.