Skip to content

ELSPROBLEMS error when running #92

@Codex-

Description

@Codex-

This is more of an FYI and how to resolve this error than any action required by the team, but posting here so others may benefit from it.

Running this for the first time may lead you to an ELSPROBLEMS error like this:

npx cyclonedx-npm
DEBUG | options: {"packageLockOnly":false,"omit":[],"flattenComponents":false,"specVersion":"1.4","outputFormat":"JSON","outputFile":"-","mcType":"application"}
DEBUG | packageFile: /Users/alexmiller/dev/app/package.json
DEBUG | projectDir: /Users/alexmiller/dev/app
DEBUG | lockFile: /Users/alexmiller/dev/app/package-lock.json
INFO  | gather dependency tree ...
DEBUG | npm-ls: run npm with ["ls","--json","--all","--long"] in /Users/alexmiller/dev/app
WARN  | npm-ls: STDERR
  npm ERR! code ELSPROBLEMS
  npm ERR! invalid: [email protected] /Users/alexmiller/dev/app/node_modules/aria-query
  npm ERR! invalid: [email protected] /Users/alexmiller/dev/app/node_modules/rxjs
  npm ERR! invalid: [email protected] /Users/alexmiller/dev/app/node_modules/pvutils
  {
    "error": {
      "code": "ELSPROBLEMS",
      "summary": "invalid: [email protected] /Users/alexmiller/dev/app/node_modules/aria-query\ninvalid: [email protected] /Users/alexmiller/dev/app/node_modules/rxjs\ninvalid: [email protected] /Users/alexmiller/dev/app/node_modules/pvutils",
      "detail": ""
    }
  }
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /Users/alexmiller/.npm/_logs/2022-08-31T03_25_49_649Z-debug-0.log
  
ERROR | npm-ls: errors
  {}
/Users/alexmiller/dev/app/node_modules/@cyclonedx/cyclonedx-npm/dist/builders.js:80
            throw new Error(`npm-ls exited with errors: ${error.errno ?? '???'} ${error.code ?? npmLsReturns.status ?? 'noCode'} ${error.signal ?? npmLsReturns.signal ?? 'noSignal'}`);
            ^

Error: npm-ls exited with errors: ??? 1 noSignal
    at BomBuilder.fetchNpmLs (/Users/alexmiller/dev/app/node_modules/@cyclonedx/cyclonedx-npm/dist/builders.js:80:19)
    at BomBuilder.buildFromLockFile (/Users/alexmiller/dev/app/node_modules/@cyclonedx/cyclonedx-npm/dist/builders.js:43:41)
    at Object.run (/Users/alexmiller/dev/app/node_modules/@cyclonedx/cyclonedx-npm/dist/cli.js:97:19)
    at Object.<anonymous> (/Users/alexmiller/dev/app/node_modules/@cyclonedx/cyclonedx-npm/bin/cyclonedx-npm-cli.js:2:27)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

We can see it more clearly simply using the > npm ls --json -a -l command:

npm ERR! code ELSPROBLEMS
npm ERR! invalid: [email protected] /Users/alexmiller/dev/app/node_modules/aria-query
npm ERR! invalid: [email protected] /Users/alexmiller/dev/app/node_modules/rxjs
npm ERR! invalid: [email protected] /Users/alexmiller/dev/app/node_modules/pvutils
{
  "error": {
    "code": "ELSPROBLEMS",
    "summary": "invalid: [email protected] /Users/alexmiller/dev/app/node_modules/aria-query\ninvalid: [email protected] /Users/alexmiller/dev/app/node_modules/rxjs\ninvalid: [email protected] /Users/alexmiller/dev/app/node_modules/pvutils",
    "detail": ""
  }
}

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/alexmiller/.npm/_logs/2022-08-31T03_27_52_943Z-debug-0.log

These can be self-healed by npm by simply installing the packages effected then uninstalling them (returning them to the locked state of the dependency):

> npm i -D [email protected] && npm uninstall aria-query

Now when you run npm ls --json -a -l again you may meet another package that needs the same treatment, after you've resolved these you should be able to use cyclonedx-npm normally 🚀

I suppose a followup question to this is: Since we know how to resolve these simple cases, should this functionality be tied into cyclonedx-npm?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions