Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gyp ERR! stack TypeError: tar.extract is not a function #1871

Closed
bitcoinvsalts opened this issue Sep 5, 2019 · 19 comments
Closed

gyp ERR! stack TypeError: tar.extract is not a function #1871

bitcoinvsalts opened this issue Sep 5, 2019 · 19 comments

Comments

@bitcoinvsalts
Copy link

$ node -v
v10.14.2

$ npm -v
6.4.1

Platform: macOS Catalina

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info find Python using Python version 2.7.15 found at "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
gyp http GET https://nodejs.org/download/release/v10.14.2/node-v10.14.2-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v10.14.2/node-v10.14.2-headers.tar.gz
gyp ERR! UNCAUGHT EXCEPTION 
gyp ERR! stack TypeError: tar.extract is not a function
gyp ERR! stack     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:198:22)
gyp ERR! stack     at Request.emit (events.js:187:15)
gyp ERR! stack     at Request.onRequestResponse (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1066:10)
gyp ERR! stack     at ClientRequest.emit (events.js:182:13)
gyp ERR! stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21)
gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
gyp ERR! stack     at TLSSocket.socketOnData (_http_client.js:442:20)
gyp ERR! stack     at TLSSocket.emit (events.js:182:13)
gyp ERR! stack     at addChunk (_stream_readable.js:283:12)
gyp ERR! stack     at readableAddChunk (_stream_readable.js:264:11)
gyp ERR! System Darwin 19.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure"
gyp ERR! cwd /Users/herve76/Documents/GitHub/nbt-1357/node_modules/talib
gyp ERR! node -v v10.14.2
gyp ERR! node-gyp -v v5.0.3
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR!     <https://github.com/nodejs/node-gyp/issues>

Any idea why?

@cclauss
Copy link
Contributor

cclauss commented Sep 6, 2019

macOS Catalina is not yet released and not yet supported.

@bitcoinvsalts
Copy link
Author

Actually I re-installed npm and it is now working.

@adamreisnz
Copy link

Running into the same error with Node 12.14.0 and node-gyp 5.0.5 on OS X Mojave. Any thoughts? Node 10 builds fine.

@martianboy
Copy link

Running in the same problem with Node v13.5.0 on Ubuntu 19.10. I can't seem to compile node myself and get npm rebuild to work.

@adamreisnz
Copy link

Can this be re-opened please? Just about every build I run is failing due to this error.

@cclauss
Copy link
Contributor

cclauss commented Jan 9, 2020

Did you reinstall npm as suggested above?

@adamreisnz
Copy link

adamreisnz commented Jan 9, 2020

I reinstalled npm and yarn both, to no avail.

I then manually globally installed a new version of node-gyp to my global npm packages and moved that to the location where it was erroring. That got me one step further.

Or maybe it was a step back. Now it's failing with even worse errors.

@rvagg
Copy link
Member

rvagg commented Jan 10, 2020

I think this is normally a sign of mixed installs - one version is trying to use code from another - or an install that didn't properly overwrite an older install (there was a bug a while back with npm that caused this exact error because upgrading npm didn't wipe out older files and directories, leaving a jumbled mess).

  1. Clean out your global npm installs, it's going to be /usr/local/lib/node_modules or /usr/lib/node_modules - npm config get prefix shows you the first part of this and it'll depend on how Node was installed on your machine. Just blow that whole directory away because you're going to reinstall anyway. There may be global commands you installed with npm install -g which will be dangling symlinks to subdirectories of that directory, look in the bin with the same root, so /usr/local/bin/ or /usr/bin and look for symlinks that have node_modules in them and get rid of them. If you care about the things you installed globall, take not of them so you can reinstall later.
  2. Remove node, nodejs, npm, node-gyp from your system package manager (apt, dnf, yum, apk, etc.). Full purge, leave nothing, these cause too much chaos with the way npm handles dependencies.
  3. Install Node from somewhere other than your package manager, I recommend using the NodeSource distributions: https://github.com/nodesource/distributions for servers but the Snap (maintained by me) https://snapcraft.io/node for development systems (I can't understate how nice it is to have the latest version of my chosen release line without asking for it on my dev machine). You could also take a more manual approach such as https://gist.github.com/rvagg/742f811be491a49ba0b9

@adamreisnz
Copy link

This is not a feasible solution for 50 of our raspberry pi's

@Hyperblaster
Copy link

Is there an actual solution to this? I can't install running on ubuntu with node 12

@adamreisnz
Copy link

The only solution that actually fixes this which has been offered, is to reinstall your complete system and remove anything to do with Node, npm, yarn, and start from scratch.

Understandably, this is far from an ideal solution and the fact that it's even suggested as an option is very dubious.

I managed to get it up and running on our development machines without nuking the whole environment by mucking around a lot, and manually moving some package files and ignoring a lot of errors that came up. I haven't documented exact steps, as it was a messy process.

@ivanhoe-dev
Copy link

This issue should be reopened, I spent one working day on this bug! Can't find a way to resolve!

@cclauss
Copy link
Contributor

cclauss commented Mar 31, 2020

@taoliujun
Copy link

I resolved it with reinstall node.
I think that node-gyp was broken after mac os upgrade.

@zilti
Copy link

zilti commented Sep 29, 2020

Sure, just mark issues as "closed" even if they aren't resolved, that makes the problems magically disappear...

@asukiaaa
Copy link

asukiaaa commented Dec 7, 2020

It seems problem of npm or n.
I'm not remember commands in detail but re install npm by referencing command on the comment and succeeded in installing node-gyp.
tj/n#508 (comment)

@chen1164885850
Copy link

chen1164885850 commented Mar 2, 2021

真的是n 的问题,换成nvm就行了 (It's really a problem with n, just change to nvm)

@cipiripper
Copy link

This was the problem with n for me as well. It creates a mess with npm dependencies. I have fixed the issue with manually installing the appropriate npm for the version of node that I use (14.18.0). In my case the npm I need is 6.14.15.

To fix npm (this example is for my node - check the npm version you need for your node):

sudo npm install -g [email protected]

@qlehenaff-hexagone
Copy link

Resolved the issue by removing all the node/yarn caches

@nodejs nodejs locked as resolved and limited conversation to collaborators Mar 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests