node-pre-gyp ERR! build error
See original GitHub issue-
Node Version:
node
: v14.5.0 andnpm -v
:6.14.5 -
Platform: Linux raspberrypi 4.19.118+ #1311 Mon Apr 27 14:16:15 BST 2020 armv6l GNU/Linux
-
Compiler: COLLECT_GCC=cc COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/8/lto-wrapper Target: arm-linux-gnueabihf Configured with: …/src/configure -v --with-pkgversion=‘Raspbian 8.3.0-6+rpi1’ --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --disable-werror --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf Thread model: posix gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)
-
Module: I am trying to install Sqlite3 on a raspberry pi zero which works on armv6. By using this command
npm install sqlite3 --save
, I get this output.
Verbose output (from npm or node-gyp):
> sqlite3@4.2.0 install /home/pi/Smartvac/SmartVacAppV3.1/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v83-linux-arm
node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.2.0 and node@14.5.0 (node-v83 ABI, glibc) (falling back to
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:199:22)
gyp ERR! stack at Request.emit (events.js:326:22)
gyp ERR! stack at Request.onRequestResponse (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1066:1
gyp ERR! stack at ClientRequest.emit (events.js:314:20)
gyp ERR! stack at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:640:27)
gyp ERR! stack at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
gyp ERR! stack at TLSSocket.socketOnData (_http_client.js:509:22)
gyp ERR! stack at TLSSocket.emit (events.js:314:20)
gyp ERR! stack at addChunk (_stream_readable.js:304:12)
gyp ERR! stack at readableAddChunk (_stream_readable.js:280:9)
gyp ERR! System Linux 4.19.118+
gyp ERR! command "/opt/nodejs/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "config-arm/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/pi/Smartvac/SmartVacAppV3.1/node_modules/sqlibel=node-v83"
gyp ERR! cwd /home/pi/Smartvac/SmartVacAppV3.1/node_modules/sqlite3
gyp ERR! node -v v14.5.0
gyp ERR! node-gyp -v v5.1.0
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>
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/opt/nodejs/bin/node /usr/local/lib/node_modules/npm/node_modules/nodb/binding/node-v83-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/pi/Smartvac/SmartVacAppV3node_napi_label=node-v83' (7)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/pi/Smartvac/SmartVacAppV3.1/node_modules/node-pre-gyp/li
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:314:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1051:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
node-pre-gyp ERR! System Linux 4.19.118+
node-pre-gyp ERR! command "/opt/nodejs/bin/node" "/home/pi/Smartvac/SmartVacAppV3.1/node_modules/.bin/node-pre-gyp" "in
node-pre-gyp ERR! cwd /home/pi/Smartvac/SmartVacAppV3.1/node_modules/sqlite3
node-pre-gyp ERR! node -v v14.5.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/opt/nodejs/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configurede_sqlite3.node --module_name=node_sqlite3 --module_path=/home/pi/Smartvac/SmartVacAppV3.1/node_modules/sqlite3/lib/bin
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"an
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@4.2.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@4.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-07-07T07_43_04_068Z-debug.log
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (7 by maintainers)
https://github.com/nodejs/node-gyp/search?q=TypeError%3A+tar.extract+is+not+a+function&type=Issues Esp. https://github.com/nodejs/node-gyp/issues/2067#issuecomment-597362973
Current versions are v7 and v0.15.0.
EDIT: I was mistaken, please disregard.
The
tar
module updated its api in its major version bump to v3. https://github.com/npm/node-tar/blob/master/CHANGELOG.md#30The correct function when depending on
tar@3
or newer is nottar.extract()
, buttar.x()
.The code depending on
tar
should be updated to reflect that.Edit: I think lines these might need to be updated:
https://github.com/nodejs/node-gyp/blob/ee6fa7d3bc80d350fb8ed2651d6f56099e5edfdd/lib/install.js#L153
https://github.com/nodejs/node-gyp/blob/ee6fa7d3bc80d350fb8ed2651d6f56099e5edfdd/lib/install.js#L198
Edit 2: slightly off-topic: node-pre-gyp also uses the incorrect function tar.extract ☹️ [1] [2]. Both this repo and that one should be updated. These must be infrequent codepaths, because I would expect them to have a 100% error rate.
Edit 3: Supposedly
.extract()
is an alias for.x()
.Edit 4: In fact it is. I tested and confirmed. Sorry for the noise. There used to be an uppercase
tar.Extract()
, which is gone now, but thankfully no-one seems to be using that anymore, at least not with newertar
.