Skip to content

Troubleshooting

Ghislain B. edited this page Aug 23, 2025 · 12 revisions

Troubleshooting Git

If you have an issue with a Git command, you might want to first try the --dry-run (or "dryRun": true in the lerna.json config file) option, that will output all the Git commands in the shell (as info logs) without executing them. Another great, and possibly much more useful suggestion, is to search in the Lerna issues because most of the code came originally from that library. If you still have problems and you wish to troubleshoot the actual code yourself then follow the steps shown below.

Troubleshoot via Editor (like VSCode)

If you want to troubleshoot the actual code of the library, you could do it via 1 of the following 2 ways that I found so far.

1. by Attaching to NodeJS Port

a. start the script by passing --inspect-brk (the brk is to break on first line before attaching)

# debug lerna version
"debug:lerna": "node --inspect-brk ./node_modules/@lerna-lite/cli/dist/cli.js version --dry-run"

b. attach to the NodeJS port (add the following config to your VSCode launch.json)

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "attach",
      "name": "Attach to Lerna CLI",
      "port": 9229,
      "restart": true,
      "timeout": 10000,
      "localRoot": "${workspaceFolder}/node_modules/@lerna-lite/cli/dist"
    }
  ]
}

2. via Launch Program (debugging Lerna JS files directly)

add the following config to your VSCode launch.json and open any of the Lerna-Lite files located in node_modules/@lerna-lite/ folders that you wish to troubleshoot and finally add any necessary breakpoints

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Debug Lerna CLI",
      "program": "${workspaceFolder}/node_modules/@lerna-lite/cli/dist/cli.js",
      "outFiles": ["${workspaceFolder}/node_modules/@lerna-lite/cli/dist/**/*.js"],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "stopOnEntry": false,
      "args": [
        "version",
        "--dry-run",
        "--yes"
      ],
      "runtimeArgs": ["--inspect-brk"]
    }
  ]
}

Clone this wiki locally