[BUG] Cannot read properties of undefined (reading 'description')
Open
Nobody has claimed this yet.
Bug
cmd:list
Needs Triage
Release 8.x
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
For some dependencies in a project's package.json a TypeError occurs when npm ll -a is executed.
For example,, if package.json contains the following dependenciy:
{
"dependencies": {
"ws": "8.11.0"
}
}
the following error occurs when executing npm ll -a:
$ npm --version
8.19.2
$ npm ll -a
npm ERR! Cannot read properties of undefined (reading 'description')
npm ERR! A complete log of this run can be found in:
npm ERR! ~`.npm/_logs/2022-12-13T20_36_19_543Z-debug-0.log
while the log file contains the following stacktrace:
9 verbose stack TypeError: Cannot read properties of undefined (reading 'description')
39 verbose stack at getHumanOutputItem (~/.nvm/versions/node/v18.12.1/lib/node_modules/npm/lib/commands/ls.js:339:35)
39 verbose stack at visit (~/.nvm/versions/node/v18.12.1/lib/node_modules/npm/lib/commands/ls.js:160:15)
39 verbose stack at visitNode (~/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/treeverse/lib/breadth.js:37:25)
39 verbose stack at next (~/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/treeverse/lib/breadth.js:23:19)
39 verbose stack at ~/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/treeverse/lib/breadth.js:25:31
39 verbose stack at async LL.exec (~/.nvm/versions/node/v18.12.1/lib/node_modules/npm/lib/commands/ls.js:122:20)
39 verbose stack at async module.exports (~/.nvm/versions/node/v18.12.1/lib/node_modules/npm/lib/cli.js:78:5)
Expected Behavior
Full dependency tree to be printed for a project
Steps To Reproduce
- Tested on Linux with NPM v.8.19.2
- With a project that has a dependency like the following:
{
"dependencies": {
"ws": "8.11.0"
}
}
- Run 'npm ll -a'
- See error...
Environment
- npm: 8.19.2
- Node.js: v18.12.1
- OS Name:Fedora Linux 36 (Workstation Edition)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with npm ll -a using a package.json dependency on ws 8.11.0, then start in lib/commands/ls.js at getHumanOutputItem and the visit path named in the stack trace. Done means the command prints the full dependency tree without the TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100