Skip to content

Conversation

@burkedavison
Copy link

@burkedavison burkedavison commented Dec 30, 2020

What / Why
I am getting this error on my Jenkins docker build:

TypeError: Cannot read property 'then' of null
  at /home/jenkins/agent/workspace/<project>/node_modules/pacote/lib/fetcher.js:355:13

This is because the return value of this[_chown] is null, and not a Promise as the tarballFile() logic assumes.

  [_chown] (path, uid, gid) {
    return selfOwner && (selfOwner.gid !== gid || selfOwner.uid !== uid)
      ? chownr(path, uid, gid)
      : /* istanbul ignore next - we don't test in root-owned folders */ null
  }

This PR attempts to simply add a null check and otherwise maintain behavior. I've tested this issue with an internal build, and verified it resolves the issue.

Copy link
Contributor

@isaacs isaacs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One extremely minor nit which I'm happy to fix up on your behalf. Good catch, this is clearly correct! Will get landed asap.

@isaacs isaacs force-pushed the bugfix/tarball-file-null-error-unix-root branch from c57035c to 5d74552 Compare January 7, 2021 19:27
@isaacs isaacs merged commit 5d74552 into npm:latest Jan 7, 2021
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

Successfully merging this pull request may close these issues.

2 participants