romgrk / node-gtk

GTK+ bindings for NodeJS (via GObject introspection)
MIT License
494 stars 41 forks source link

403 on downloading npm binary #291

Closed normtown closed 3 years ago

normtown commented 3 years ago

When doing npm install node-gtk, I am getting a 403 when trying to download the binary from S3. Are the permissions set correctly on bucket/object?

#6 20.44 > node-gtk@0.8.1 install /node_modules/node-gtk
#6 20.44 > if [ "$(uname)" = "Darwin" ] && [ "$(which brew)" != "" ]; then export PKG_CONFIG_PATH=$(brew --prefix libffi)/lib/pkgconfig; fi; node-pre-gyp install --fallback-to-build
#6 20.44 
#6 22.33 node-pre-gyp ERR! install response status 403 Forbidden on https://node-gtk-1.s3.amazonaws.com/node_gtk/v0.8.1/node_gtk-node-v64-li
[2021-04-30T22:25:43.571Z] [PID 16618] nux-x64.tar.gz 
#6 22.33 node-pre-gyp WARN Pre-built binaries not installable for node-gtk@0.8.1 and node@10.19.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp) 
#6 22.33 node-pre-gyp WARN Hit error response status 403 Forbidden on https://node-gtk-1.s3.amazonaws.com/node_gtk/v0.8.1/node_gtk-node-v64-linux-x64.tar.gz 
#6 23.97 gyp ERR! UNCAUGHT EXCEPTION 
#6 23.97 gyp ERR! stack TypeError: invalid options argument
#6 23.97 gyp ERR! stack     at optsArg (/node_modules/mkdirp/lib/opts-arg.js:13:11)
#6 23.97 gyp ERR! stack     at mkdirp (/node_modules/mkdirp/index.js:11:10)
#6 23.97 gyp ERR! stack     at createBuildDir (/usr/share/nodejs/node-gyp/lib/configure.js:80:5)
#6 23.97 gyp ERR! stack     at getNodeDir (/usr/share/nodejs/node-gyp/lib/configure.js:54:9)
#6 23.97 gyp ERR! stack     at /usr/share/nodejs/node-gyp/lib/configure.js:30:7
#6 23.97 gyp ERR! stack     at process._tickCallback (internal/process/next_tick.js:61:11)
#6 23.97 gyp ERR! System Linux 4.19.121-linuxkit

The installation further fails because of an error in the fallback build:

[2021-04-30T22:25:43.571Z] [PID 16618]  23.98 gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "configure" "--fallback-to-build" "--module=/node_modules/node-gtk/lib/binding/node-v64-linux-x64/node_gtk.node" "--module_name=node_gtk" "--module_path=/node_modules/node-gtk/lib/binding/node-v64-linux-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
#6 23.98 gyp ERR! cwd /node_modules/node-gtk
#6 23.98 gyp ERR! node -v v10.19.0
#6 23.98 gyp ERR! node-gyp -v v6.1.0
#6 23.98 gyp ERR! This is a bug in `node-gyp`.
#6 23.98 gyp ERR! Try to update node-gyp and file an Issue if it does not help:
#6 23.98 gyp ERR!     <https://github.com/nodejs/node-gyp/issues>
#6 23.99 node-pre-gyp ERR! build error 
#6 23.99 node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/bin/node-gyp configure --fallback-to-build --module=/node_modules/node-gtk/lib/binding/node-v64-linux-x64/node_gtk.node --module_name=node_gtk --module_path=/node_modules/node-gtk/lib/binding/node-v64-linux-x64 --napi_versio
[2021-04-30T22:25:43.572Z] [PID 16618] n=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (7)
#6 23.99 node-pre-gyp ERR! stack     at ChildProcess.cmd.on (/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
#6 23.99 node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
#6 23.99 node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
#6 23.99 node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
#6 23.99 node-pre-gyp ERR! System Linux 4.19.121-linuxkit
#6 23.99 node-pre-gyp ERR! command "/usr/bin/node" "/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
#6 23.99 node-pre-gyp ERR! cwd /node_modules/node-gtk
#6 23.99 node-pre-gyp ERR! node -v v10.19.0
#6 23.99 node-pre-gyp ERR! node-pre-gyp -v v1.0.4
#6 23.99 node-pre-gyp ERR! not ok 
#6 23.99 Failed to execute '/usr/bin/node /usr/bin/node-gyp configure --fallback-to-build --module=/node_modules/node-gtk/lib/binding/node-v64-linux-x64/node_gtk.node --module_nam
[2021-04-30T22:25:43.574Z] [PID 16618] e=node_gtk --module_path=/node_modules/node-gtk/lib/binding/node-v64-linux-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (7)
#6 24.49 npm WARN enoent ENOENT: no such file or directory, open '/package.json'
#6 24.49 npm WARN !invalid#1 No description
#6 24.49 npm WARN !invalid#1 No repository field.
#6 24.49 npm WARN !invalid#1 No README data
#6 24.49 npm WARN !invalid#1 No license field.
#6 24.49 
#6 24.50 npm ERR! code ELIFECYCLE
#6 24.50 npm ERR! errno 1
#6 24.50 npm ERR! node-gtk@0.8.1 install: `if [ "$(uname)" = "Darwin" ] && [ "$(which brew)" != "" ]; then export PKG_CONFIG_PATH=$(brew --prefix libffi)/lib/pkgconfig; fi; node-pre-gyp install --fallback-to-build`
#6 24.50 npm ERR! Exit status 1
#6 24.50 npm ERR! 
#6 24.50 npm ERR! Failed at the node-gtk@0.8.1 install script.
#6 24.50 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
normtown commented 3 years ago

It looks like the most recent downloadable version is 0.5.1. All the more recent versions return a 403.

normtown commented 3 years ago

Specifying npm install node-gtk@0.5.1 appears to fail. Maybe because mkdirp moved to promises?

#6 24.26 TypeError: invalid options argument
#6 24.26     at optsArg (/node_modules/mkdirp/lib/opts-arg.js:13:11)
#6 24.26     at mkdirp (/node_modules/mkdirp/index.js:11:10)
#6 24.26     at inferOwner.then.owner (/usr/share/npm/node_modules/gentle-fs/lib/mkdir.js:14:5)
#6 24.27 Error: npm.load() required
#6 24.27     at Object.get (/usr/share/npm/lib/npm.js:59:13)
#6 24.27     at process.errorHandler (/usr/share/npm/lib/utils/error-handler.js:205:32)
#6 24.27     at process.emit (events.js:198:13)
#6 24.27     at emitPromiseRejectionWarnings (internal/process/promises.js:140:18)
#6 24.27     at process._tickCallback (internal/proc
[2021-04-30T23:35:22.109Z] [PID 50362] ess/next_tick.js:69:34)
#6 24.27 /usr/share/npm/lib/npm.js:59
#6 24.27       throw new Error('npm.load() required')
#6 24.27       ^
#6 24.27 
#6 24.27 Error: npm.load() required
[2021-04-30T23:35:22.109Z] [PID 50362] 
#6 24.27     at Object.get (/usr/share/npm/lib/npm.js:59:13)
#6 24.27     at process.errorHandler (/usr/share/npm/lib/utils/error-handler.js:205:32)
#6 24.27     at process.emit (events.js:198:13)
#6 24.27     at process._fatalException (internal/bootstrap/node.js:497:27)
------
romgrk commented 3 years ago

Can't reproduce, but you're using an LTS version for which support has ended and for which node-gtk doesn't provide pre-built binaries nor supports. Please upgrade to a supported version, and report back if you're still unable to install.

The bucket is public so there shouldn't be any problem, though I'd expect it to return a 404 in this case.

Screenshot from 2021-04-30 21-17-16

If your issue persists, don't forget to provide your nodejs & OS versions.

normtown commented 3 years ago

Looks like the bucket permissions are correct. Did you also check the individual objects?

LTS of what? My container is built on the LTS of Ubuntu (focal) and there is no newer LTS of that. Do you mean something else?

romgrk commented 3 years ago

Nodejs LTS. You're using version 10.19.0, according to the logs posted up here, that version is unsupported by both nodejs and node-gtk.

https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

normtown commented 3 years ago

Thanks. It looks like snap or nodesource are the ways to get newer versions now. The Ubuntu deb repo is still on node 10.

I’m not sure this explains the auth issues on the node-gtk objects in S3. I get 403 for > 0.5.1 even if I use a web browser on a Mac laptop.

normtown commented 3 years ago

I also just tried to download https://node-gtk-1.s3.amazonaws.com/node_gtk/v0.8.1/node_gtk-node-v64-linux-x64.tar.gz from Safari on my phone and that also returns a 403.

romgrk commented 3 years ago

That file does not exist. You're trying to download a prebuilt binary for nodejs v10, but there is none because it is not supported by node-gtk. Upgrade to a supported nodejs and try again.

normtown commented 3 years ago

Thanks for the explanation. Yeah, it’s weird that’s a 403 rather than a 404.