-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
outdated: fix rendering for global dependencies #173
Conversation
@zkat Error is back again. npm 6.9.0.
Stack:
|
Looks like the code is gone https://github.com/npm/cli/blob/latest/lib/outdated.js#L152 It looks it's gonna be fixed in 6.9.1 |
Looks like the code what fixed it is gone. So I reintroduce it. npm#173
Is this issue every going to be released? The latest version of node 11.14.0 includes npm v6.9.0 with this bug... |
I just found out I was getting the same error, from the same operation
function dotindex (c) {
var m = /\.[^.]*$/.exec(c);
if (m) {return m.index + 1}
else if (c !== undefined) {return c.length}
else return 0
} NOTE: However, I don’t know enough about npm’s architecture to say whether this is actually the correct solution. It may be that the real issue is that npm is calling the I’ll let the experts take it from here. |
@jtsom While we wait for npm i -g npm@6.9.1-next.0 |
@nikoladev Thanks! That is awesome :D |
Why isn't it in @latest yet? |
Hello? Anyone home? Yet another node release (12.3) that includes the broken 6.9.0. What's the hold up?? Having to remember to reinstall a .next.0 version of NPM every time is not ideal. |
I’ve been wondering the same thing! So much work has gone into |
This fix was merged on 2019-03-20. Why hasn’t it been published as a |
node 10.16 LTS is now also broken, beeing shipped with npm 6.9.0. Please take action. |
Hi everyone, here’s an update on what’s been happening with the open PRs https://gist.github.com/aeschright/8ed09cbc2a4aee00fcb4ad35086d76a6 |
@aeschright Thanks for writing that note. I am so sorry to hear the news. I really hope the company gets its head back on straight. |
@ZuBB I was having the same "Cannot read property 'length' of undefined" error when running |
@zkat I've just applied your change with the shipped npm v6.9.0 in nodejs v12.5.0. The error message is gone, but the column "Location" shows "global". I expected it to be I would suggest to improve your PR by changing to // outdated.js L148-153
var columns = [ depname,
has || 'MISSING',
want,
latest,
deppath || npm.dir
// or
// deppath || `(global) ${npm.dir}`
] Follow-up Question 1During the troubleshooting, I see one place potential to be the root cause. // outdated.js L216-222
function outdated_ (args, path, tree, parentHas, depth, opts, cb) {
if (!tree.package) tree.package = {}
if (path && moduleName(tree)) path += ' > ' + tree.package.name
if (!path && moduleName(tree)) path = tree.package.name // <---- name set to be path??
if (depth > opts.depth) {
return cb(null, [])
} The function // utils/module-name.js
var unknown = 0
function moduleName (tree) {
if (tree.name) { return tree.name }
var pkg = tree.package || tree
if (isNotEmpty(pkg.name) && typeof pkg.name === 'string') return pkg.name.trim()
var pkgName = pathToPackageName(tree.path)
if (pkgName !== '') return pkgName
if (tree._invalidName != null) return tree._invalidName
tree._invalidName = '!invalid#' + (++unknown)
return tree._invalidName
} If name is invalid, the function will return
Regarding this logic, the variable |
Fixes: https://npm.community/t/npm-outdated-throw-an-error-cannot-read-property-length-of-undefined/5929