allartk / leaflet.offline

Leaflet offline layer
https://allartk.github.io/leaflet.offline/
GNU Lesser General Public License v3.0
311 stars 76 forks source link

Cannot GET / #307

Closed ElementQi closed 1 year ago

ElementQi commented 1 year ago

I'm a beginner in javascript, node.js etc.

In Ubuntu 18.04, with nodejs v16.20.2 and npm 8.19.4, I finished building from cloning the latest version of the project.

After using

npm run serve
> docs@1.0.0 serve
> webpack serve --mode development

Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:9000/
<i> [webpack-dev-server] On Your Network (IPv4): http://192.168.3.70:9000/
<i> [webpack-dev-server] Content not from webpack is served from '/home/limengqi/workspaces/leafletOffline/leaflet.offline/docs/_site' directory
asset index.js 1.18 MiB [emitted] (name: index)
asset apilayer.js 1.18 MiB [emitted] (name: apilayer)
asset list.js 747 KiB [emitted] (name: list)
asset leaflet.offline.bundle.js 13.7 KiB [emitted] [from: node_modules/leaflet.offline/dist/bundle.js] [copied]
runtime modules 79.2 KiB 33 modules
cacheable modules 1.02 MiB
  modules by path ./node_modules/ 581 KiB 24 modules
  modules by path ./src/ 6.18 KiB
    ./src/index.js 2.15 KiB [built] [code generated]
    ./src/list.js 1.76 KiB [built] [code generated]
    ./src/apilayer.js 1.11 KiB [built] [code generated]
    + 2 modules
  modules by path ../ 462 KiB
    modules by path ../node_modules/idb/build/*.js 10.8 KiB 2 modules
    ../dist/bundle.js 13.7 KiB [built] [code generated]
    ../node_modules/leaflet/dist/leaflet-src.js 437 KiB [built] [code generated]
webpack 5.76.0 compiled successfully in 1698 ms

I use Chrome to open http://localhost:9000/ or http://192.168.3.70:9000/, get Cannot GET / in the explorer.

Opening http://localhost:9000/index.html get Cannot GET /index.html in the explorer.

The same thing happened in my windows 10 as well.

ElementQi commented 1 year ago

I think it is the _site folder that cannot be created successfully to blame. Because in the docs folders, there are some template html files like index.html and list.html. Are some codes messing in the /docs/webpack.config.js? Especially in plugins under that file.

allartk commented 1 year ago

It seems you found a mistake in the docs: https://github.com/allartk/leaflet.offline#development For running the example website locally (like the one your see on https://allartk.github.io/leaflet.offline/) it should be (from the docs folder):

npm install && npm start

Beside webpack, this will also start a docker container for building the jekyll website