Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdxgen fails to run with only a package-lock.json #1680

Open
scrocquesel-ml150 opened this issue Mar 12, 2025 · 1 comment
Open

cdxgen fails to run with only a package-lock.json #1680

scrocquesel-ml150 opened this issue Mar 12, 2025 · 1 comment

Comments

@scrocquesel-ml150
Copy link

Given a current directory with just a package-lock.json

{
  "name": "test",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {}
}

When I run docker run --rm -v "$PWD:/app" ghcr.io/cyclonedx/cdxgen -r /app

Then it fails with

file:///opt/cdxgen/lib/cli/index.js:3089
    if (options.projectType.length) {
                            ^

TypeError: Cannot read properties of undefined (reading 'length')
    at createNodejsBom (file:///opt/cdxgen/lib/cli/index.js:3089:29)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async createMultiXBom (file:///opt/cdxgen/lib/cli/index.js:6619:17)
    at async createBom (file:///opt/cdxgen/lib/cli/index.js:7840:16)
    at async file:///opt/cdxgen/bin/cdxgen.js:778:20

Node.js v23.8.0

Using latest image Digest: sha256:a43dd3c9da54ed438b7697d11ffe050d31893260df9f2a705e964551561663d9

@prabhu
Copy link
Collaborator

prabhu commented Mar 12, 2025

Nice one. Will include the fix in a branch I am working on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants