Skip to content

Troubleshooting

Ghislain B edited this page Mar 20, 2023 · 9 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 ways which I found so far.

Note: if you find a better way of troubleshooting/debugging then please let me know (you could open a new Discussion)

1. by Attaching to NodeJS Port

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

# roll a new version
node --inspect-brk ./node_modules/@lerna-lite/cli/dist/cli.js version 

# or publish a new version
node --inspect-brk ./node_modules/@lerna-lite/cli/dist/cli.js publish

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

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Attach",
      "port": 9229,
      "request": "attach",
      "skipFiles": [
        "<node_internals>/**"
      ],
      "type": "pwa-node"
    }
  ]
}

2. via Launch Program

add the following config to your VSCode launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch Program",
      "program": "${workspaceFolder}/node_modules/@lerna-lite/cli/dist/cli.js",
      "args": [
        "${relativeFile}",
        "--version",
        "--dry-run"
      ],
      "console": "integratedTerminal",
      "request": "launch",
      "skipFiles": [
        "<node_internals>/**"
      ],
      "type": "pwa-node",
      "protocol": "inspector",
      "stopOnEntry": true,
      "internalConsoleOptions": "openOnSessionStart"
    }
  ]
}