node-tar icon indicating copy to clipboard operation
node-tar copied to clipboard

[BUG] Tar upgrade from 6.1.0 to 6.1.9/6.1.10 throws error

Open psxpa3 opened this issue 4 years ago • 5 comments

Hello, I am trying to upgrade tar version. However, getting this error TypeError: Cannot destructure property isAbsolute of 'undefined' or 'null'.

   5 | import * as tmp from "tmp";
   6 | // import * as tar from "tar";
>  7 | const tar = require("tar");

Could anybody provide some direction?

psxpa3 avatar Nov 16 '21 15:11 psxpa3

What is the context in which you are loading tar? Is this a node program?

isAbsolute is destructured from require('path'), which should definitely not be undefined or null.

isaacs avatar Nov 18 '21 22:11 isaacs

Thanks for the reply @isaacs. Yes, it is a node program. The thing is I am trying to upgrade tar version from 6.1.0 to 6.1.1+, and yarn test fails with the above error

psxpa3 avatar Nov 18 '21 23:11 psxpa3

Can you add a line in there like console.log(require("path")) to show what it's returning?

isaacs avatar Feb 27 '22 07:02 isaacs

Also, the full stack trace from the error would be helpful.

My hunch is that somehow require('path').win32 isn't set, so the destructuring in ib/strip-absolute-path.js is the problem. What does node -v output?

isaacs avatar Feb 27 '22 07:02 isaacs

Hi @psxpa3 were you able to resolve this issue? I am trying to update tar to the same version and facing the same issue.

janhavi529 avatar May 12 '22 07:05 janhavi529

Will reopen when the questions above are answered.

isaacs avatar Apr 07 '23 06:04 isaacs

@isaacs I am seeing similar issues as well. Here are some related information: Error trace: Screen Shot 2023-06-08 at 9 27 08 PM Dependencies: Screen Shot 2023-06-08 at 9 27 36 PM My file: Screen Shot 2023-06-08 at 9 28 08 PM

Node version: node: '16.18.0'

It would be really helpful if you could point me to the right direction! Thank you so much!

jiaxin-ge avatar Jun 09 '23 04:06 jiaxin-ge