maptiler / tileserver-gl

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
https://tileserver.readthedocs.io/en/latest/
Other
2.19k stars 632 forks source link

403 Forbidden on install #523

Open trentwiles opened 3 years ago

trentwiles commented 3 years ago
npm ERR! code 1
npm ERR! path /home/pi/.config/nvm/versions/node/v15.8.0/lib/node_modules/tileserver-gl/node_modules/@mapbox/mapbox-gl-native
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build=false
npm ERR! 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/@mapbox/mapbox-gl-native/v5.0.2/node-v88-linux-arm-Release.tar.gz
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@0.10.3
npm ERR! node-pre-gyp info using node@15.8.0 | linux | arm
npm ERR! node-pre-gyp WARN Using request for node-pre-gyp https download
npm ERR! node-pre-gyp info check checked for "/home/pi/.config/nvm/versions/node/v15.8.0/lib/node_modules/tileserver-gl/node_modules/@mapbox/mapbox-gl-native/lib/node-v88/mbgl.node" (not found)
npm ERR! node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/@mapbox/mapbox-gl-native/v5.0.2/node-v88-linux-arm-Release.tar.gz
npm ERR! node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/@mapbox/mapbox-gl-native/v5.0.2/node-v88-linux-arm-Release.tar.gz
npm ERR! node-pre-gyp ERR! install error
npm ERR! node-pre-gyp ERR! stack Error: 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/@mapbox/mapbox-gl-native/v5.0.2/node-v88-linux-arm-Release.tar.gz
npm ERR! node-pre-gyp ERR! stack     at Request.<anonymous> (/home/pi/.config/nvm/versions/node/v15.8.0/lib/node_modules/tileserver-gl/node_modules/node-pre-gyp/lib/install.js:137:27)
npm ERR! node-pre-gyp ERR! stack     at Request.emit (node:events:390:22)
npm ERR! node-pre-gyp ERR! stack     at Request.onRequestResponse (/home/pi/.config/nvm/versions/node/v15.8.0/lib/node_modules/tileserver-gl/node_modules/request/request.js:1059:10)
npm ERR! node-pre-gyp ERR! stack     at ClientRequest.emit (node:events:378:20)
npm ERR! node-pre-gyp ERR! stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:636:27)
npm ERR! node-pre-gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (node:_http_common:129:17)
npm ERR! node-pre-gyp ERR! stack     at TLSSocket.socketOnData (node:_http_client:502:22)
npm ERR! node-pre-gyp ERR! stack     at TLSSocket.emit (node:events:378:20)
npm ERR! node-pre-gyp ERR! stack     at addChunk (node:internal/streams/readable:313:12)
npm ERR! node-pre-gyp ERR! stack     at readableAddChunk (node:internal/streams/readable:288:9)
npm ERR! node-pre-gyp ERR! System Linux 5.4.51-v7l+
npm ERR! node-pre-gyp ERR! command "/home/pi/.config/nvm/versions/node/v15.8.0/bin/node" "/home/pi/.config/nvm/versions/node/v15.8.0/lib/node_modules/tileserver-gl/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build=false"
npm ERR! node-pre-gyp ERR! cwd /home/pi/.config/nvm/versions/node/v15.8.0/lib/node_modules/tileserver-gl/node_modules/@mapbox/mapbox-gl-native
npm ERR! node-pre-gyp ERR! node -v v15.8.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.10.3
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2021-03-03T20_43_35_483Z-debug.log
Haynesy commented 3 years ago

Same issue here, have tried installing on both windows and Ubuntu


npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@0.10.3
npm ERR! node-pre-gyp info using node@15.12.0 | linux | x64
npm ERR! node-pre-gyp WARN Using needle for node-pre-gyp https download
npm ERR! node-pre-gyp info check checked for "/mnt/c/Projects/Spikes/tile-server/node_modules/@mapbox/mapbox-gl-native/lib/node-v88/mbgl.node" (not found)
npm ERR! node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/@mapbox/mapbox-gl-native/v5.0.2/node-v88-linux-x64-Release.tar.gz
npm ERR! node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/@mapbox/mapbox-gl-native/v5.0.2/node-v88-linux-x64-Release.tar.gz
npm ERR! node-pre-gyp ERR! install error
npm ERR! node-pre-gyp ERR! stack Error: 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/@mapbox/mapbox-gl-native/v5.0.2/node-v88-linux-x64-Release.tar.gz
npm ERR! node-pre-gyp ERR! stack     at PassThrough.<anonymous> (/mnt/c/Projects/Spikes/tile-server/node_modules/node-pre-gyp/lib/install.js:137:27)
npm ERR! node-pre-gyp ERR! stack     at PassThrough.emit (node:events:381:22)
npm ERR! node-pre-gyp ERR! stack     at ClientRequest.<anonymous> (/mnt/c/Projects/Spikes/tile-server/node_modules/needle/lib/needle.js:508:9)
npm ERR! node-pre-gyp ERR! stack     at Object.onceWrapper (node:events:476:26)
npm ERR! node-pre-gyp ERR! stack     at ClientRequest.emit (node:events:369:20)
npm ERR! node-pre-gyp ERR! stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:636:27)
npm ERR! node-pre-gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (node:_http_common:129:17)
npm ERR! node-pre-gyp ERR! stack     at TLSSocket.socketOnData (node:_http_client:502:22)
npm ERR! node-pre-gyp ERR! stack     at TLSSocket.emit (node:events:369:20)
npm ERR! node-pre-gyp ERR! stack     at addChunk (node:internal/streams/readable:313:12)
npm ERR! node-pre-gyp ERR! System Linux 5.4.72-microsoft-standard-WSL2
npm ERR! node-pre-gyp ERR! command "/usr/bin/node" "/mnt/c/Projects/Spikes/tile-server/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build=false"
npm ERR! node-pre-gyp ERR! cwd /mnt/c/Projects/Spikes/tile-server/node_modules/@mapbox/mapbox-gl-native
npm ERR! node-pre-gyp ERR! node -v v15.12.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.10.3
npm ERR! node-pre-gyp ERR! not ok```
AndyHuska commented 3 years ago

same on Ubuntu 20.04 which required running "npm_config_user=root npm install -g tileserver-gl" to get past some of these errors:

node-pre-gyp WARN Using request for node-pre-gyp https download node-pre-gyp WARN Pre-built binaries not installable for sqlite3@4.2.0 and node@14.16.1 (node-v83 ABI, glibc) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/lib/node_modules/tileserver-gl/node_modules/sqlite3/lib/binding' gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/14.16.1" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/tileserver-gl/node_modules/sqlite3/.node-gyp" gyp WARN install got an error, rolling back install gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/tileserver-gl/node_modules/sqlite3/.node-gyp' gyp ERR! System Linux 5.8.0-49-generic gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/lib/node_modules/tileserver-gl/node_modules/sqlite3/lib/binding/node-v83-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/usr/lib/node_modules/tileserver-gl/node_modules/sqlite3/lib/binding/node-v83-linux-x64" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83" gyp ERR! cwd /usr/lib/node_modules/tileserver-gl/node_modules/sqlite3 gyp ERR! node -v v14.16.1 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok

carderne commented 3 years ago

You can use npm install -g tileserver-gl-light (which doesn't have the mapbox-gl-native dependency) to get around this (assuming you don't need that functionality).

JaffaKetchup commented 2 years ago

Unfortunately, I need the full version. Is there any better solution?

answerquest commented 2 years ago

https://mapbox-node-binary.s3.amazonaws.com/@mapbox/mapbox-gl-native/v5.0.2/node-v83-linux-x64-Release.tar.gz : this .tar.gz isn't available on the stated URL anymore, or its access has now been restricted. That's what's causing tileserver-gl's installation to fail. Can someone from mapbox be contacted over this? Or, if the same .tar.gz is hosted somewhere else, then we need to edit the URL in whichever place its stored.

answerquest commented 2 years ago

Would it be possible to substitude that AWS link with something a gthub release: https://github.com/mapbox/mapbox-gl-native/releases

The version number there is different - latest is "maps-v1.6.0" . Whereas here its looking for: "@mapbox/mapbox-gl-native@5.0.2"

answerquest commented 2 years ago

But this may the one we're looking for:
https://www.npmjs.com/package/@mapbox/mapbox-gl-native

latest version is 5.0.2

answerquest commented 2 years ago

Same error happens on npm install -g @mapbox/mapbox-gl-native .

How does one compile and install this thing from source, such that after it's done, when I do npm install -g tileserver-gl it picks up the locally installed @mapbox/mapbox-gl-native lib instead of trying to download the official one?

answerquest commented 2 years ago

checked in https://github.com/mapbox/mapbox-gl-native repo

found one solution here: https://github.com/mapbox/mapbox-gl-native/issues/15903 to change node version to 10. This link is working: https://mapbox-node-binary.s3.amazonaws.com/@mapbox/mapbox-gl-native/v5.0.2/node-v64-linux-x64-Release.tar.gz

Found another way forward here: https://github.com/mapbox/mapbox-gl-native/issues/16485#issuecomment-706799868
https://www.npmjs.com/package/@naturalatlas/mapbox-gl-native - v1.0.2

So I git-cloned this repo, edited package.json,
replaced the line "@mapbox/mapbox-gl-native": "5.0.2",
with "@naturalatlas/mapbox-gl-native": "1.0.2",

Addendum: Also had to replace @mapbox/mapbox-gl-native with @naturalatlas/mapbox-gl-native in 2 other places:

tileserver-gl/publish.js:
   25: delete packageJson.dependencies['@mapbox/mapbox-gl-native'];

tileserver-gl/src/serve_rendered.js:
   20: const mbgl = require('@mapbox/mapbox-gl-native');

.. and then did npm install -g to compile and install tileserver-gl into my system from the local folder.

It installed successfully this time.

But on running with a .mbtiles file, tileserver-gl mbtiles_folder/buildings-z13.mbtiles got this:

/root/building_footprints/test/tileserver-gl/node_modules/@naturalatlas/mapbox-gl-native/index.js:1
Error: libOpenGL.so.0: cannot open shared object file: No such file or directory
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1144:18) {
  code: 'ERR_DLOPEN_FAILED'
}

Giving up on this for now and trying the docker way instead.

ivandza commented 1 year ago

Did you manage to find a way to get it to work?

answerquest commented 1 year ago

@ivandza the docker way worked fine for me without any glitches. Thank heavens for containerization. sharing my docker command:

docker run --name tileserver1 -d -v "$(pwd)":/data -p 7100:8080 -p 7101:80 maptiler/tileserver-gl -c config.json -b 0.0.0.0 -u "https://server.nikhilvj.co.in/tileserver/"

It's up and running on https://server.nikhilvj.co.in/tileserver/ , showing all the previews properly, generating raster tiles, giving vector tiles properly when I add the vector layer in QGIS.

The "$(pwd)" there puts in the current working folder in ubuntu bash. I'm keeping all the files : .mbtiles, config.json, other jsons for rasterizing etc there only

Note that the operational port number changes from 80 to 8080 depending on whether you provide a config.json or not. I don't know why, but that's the way it is.

here's a sample config.json which serves one .mbtiles as both vector and raster tiles:

{
  "options": {
    "paths": {
      "root": "",
      "fonts": "",
      "sprites": "",
      "styles": "",
      "mbtiles": "/data"
    }
  },
  "styles": {
    "geosadak_roads" : {
      "style": "/data/geosadak_roads_style.json",
      "serve_rendered": true,
      "tilejson": {
        "type": "overlay",
        "bounds":[68.501795,8.078566,97.053463,35.392821]
      }
    }
  },
  "data": {
    "geosadak_roads": {
      "mbtiles": "geosadak_roads.mbtiles"
    }
  }
}

Here is the geosadak_roads_style.json mentioned above:

{
  "version": 8,
  "name": "geosadak_roads",
  "metadata": {"maputnik:renderer": "mbgljs"},
  "sources": {
    "geosadak_roads": {
      "type": "vector",
      "url":"mbtiles://geosadak_roads.mbtiles"
    }
  },
  "sprite": "",
  "glyphs": "https://orangemug.github.io/font-glyphs/glyphs/{fontstack}/{range}.pbf",
  "layers": [
    {
      "id": "geosadak_roads",
      "type": "line",
      "source": "geosadak_roads",
      "source-layer": "geosadak_roads",
      "paint": {
        "line-width": 4,
        "line-color": "rgba(255, 255, 153, 1)",
        "line-opacity": 0.8
      }
    }
  ],
  "id": "geosadak_roads"
}

Hope this helps