kosmtik / kosmtik

Make maps with OpenStreetMap and Mapnik

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

404 for leaflet related sources after local installation

alexey-gl opened this issue · comments

Hello!
After local installation npm install kosmtik Kosmtik was not loaded because leaflet related sources was not found by the server.
image

Actually httpserver trying to find it in a wrong path.
For example:

curl -i http://127.0.0.1:6789/node_modules/leaflet/dist/leaflet-src.js
HTTP/1.1 404 Not Found
Date: Fri, 06 Apr 2018 07:51:26 GMT
Connection: keep-alive
Transfer-Encoding: chunked

Not Found: /home/agladkov/tmp/kosmtik/node_modules/kosmtik/node_modules/leaflet/dist/leaflet-src.js

But the right path for this source is:

/home/agladkov/tmp/kosmtik/node_modules/leaflet/dist/leaflet-src.js

As I see from the sources PreviewServer.root is setting to __dirname at startup (which is /home/agladkov/tmp/kosmtik/node_modules/kosmtik) and all serving files is searching relating to it. It works for Kosmtik sources, but other libraries search failed.

I have:

[agladkov@linux-ai61 ~/tmp/kosmtik ]$ node -v
v8.4.0
[agladkov@linux-ai61 ~/tmp/kosmtik ]$ npm ls
/home/agladkov/tmp/kosmtik
└─┬ kosmtik@0.0.16
  ├─┬ carto@0.18.2
  │ ├── chroma-js@1.3.6
  │ ├── hsluv@0.0.3
  │ ├── js-yaml@3.8.4 extraneous
  │ ├── lodash@4.17.5
  │ ├─┬ mapnik-reference@8.7.0
  │ │ ├── lodash@4.17.5 deduped
  │ │ └── semver@5.5.0 deduped
  │ ├── semver@5.3.0 extraneous
  │ └─┬ yargs@8.0.2
  │   ├── camelcase@4.1.0
  │   ├─┬ cliui@3.2.0
  │   │ ├── string-width@1.0.2 extraneous
  │   │ ├─┬ strip-ansi@3.0.1
  │   │ │ └── ansi-regex@2.1.1
  │   │ └─┬ wrap-ansi@2.1.0
  │   │   ├── string-width@1.0.2 extraneous
  │   │   └── strip-ansi@3.0.1 deduped
  │   ├── decamelize@1.2.0
  │   ├── get-caller-file@1.0.2
  │   ├─┬ os-locale@2.1.0
  │   │ ├─┬ execa@0.7.0
  │   │ │ ├─┬ cross-spawn@5.1.0
  │   │ │ │ ├─┬ lru-cache@4.1.2
  │   │ │ │ │ ├── pseudomap@1.0.2
  │   │ │ │ │ └── yallist@2.1.2
  │   │ │ │ ├─┬ shebang-command@1.2.0
  │   │ │ │ │ └── shebang-regex@1.0.0
  │   │ │ │ └─┬ which@1.3.0
  │   │ │ │   └── isexe@2.0.0
  │   │ │ ├── get-stream@3.0.0
  │   │ │ ├── is-stream@1.1.0
  │   │ │ ├─┬ npm-run-path@2.0.2
  │   │ │ │ └── path-key@2.0.1
  │   │ │ ├── p-finally@1.0.0
  │   │ │ ├── signal-exit@3.0.2
  │   │ │ └── strip-eof@1.0.0
  │   │ ├─┬ lcid@1.0.0
  │   │ │ └── invert-kv@1.0.0
  │   │ └─┬ mem@1.1.0
  │   │   └── mimic-fn@1.2.0
  │   ├─┬ read-pkg-up@2.0.0
  │   │ ├─┬ find-up@2.1.0
  │   │ │ └─┬ locate-path@2.0.0
  │   │ │   ├─┬ p-locate@2.0.0
  │   │ │   │ └─┬ p-limit@1.2.0
  │   │ │   │   └── p-try@1.0.0
  │   │ │   └── path-exists@3.0.0
  │   │ └─┬ read-pkg@2.0.0
  │   │   ├─┬ load-json-file@2.0.0
  │   │   │ ├── graceful-fs@4.1.11 deduped
  │   │   │ ├─┬ parse-json@2.2.0
  │   │   │ │ └─┬ error-ex@1.3.1
  │   │   │ │   └── is-arrayish@0.2.1
  │   │   │ ├── pify@2.3.0
  │   │   │ └── strip-bom@3.0.0
  │   │   ├─┬ normalize-package-data@2.4.0
  │   │   │ ├── hosted-git-info@2.6.0
  │   │   │ ├─┬ is-builtin-module@1.0.0
  │   │   │ │ └── builtin-modules@1.1.1
  │   │   │ ├── semver@5.5.0 deduped
  │   │   │ └─┬ validate-npm-package-license@3.0.3
  │   │   │   ├─┬ spdx-correct@3.0.0
  │   │   │   │ ├── spdx-expression-parse@3.0.0 deduped
  │   │   │   │ └── spdx-license-ids@3.0.0
  │   │   │   └─┬ spdx-expression-parse@3.0.0
  │   │   │     ├── spdx-exceptions@2.1.0
  │   │   │     └── spdx-license-ids@3.0.0 deduped
  │   │   └─┬ path-type@2.0.0
  │   │     └── pify@2.3.0 deduped
  │   ├── require-directory@2.1.1
  │   ├── require-main-filename@1.0.1
  │   ├── set-blocking@2.0.0
  │   ├─┬ string-width@2.1.1
  │   │ ├── is-fullwidth-code-point@2.0.0 extraneous
  │   │ └── strip-ansi@4.0.0 extraneous
  │   ├── which-module@2.0.0
  │   ├── y18n@3.2.1
  │   └─┬ yargs-parser@7.0.0
  │     └── camelcase@4.1.0 deduped
  ├─┬ js-yaml@3.11.0
  │ ├─┬ argparse@1.0.10
  │ │ └── sprintf-js@1.0.3
  │ └── esprima@4.0.0 extraneous
  ├── json-localizer@0.0.3
  ├── leaflet@1.3.1
  ├── leaflet-formbuilder@0.2.3
  ├── leaflet-hash@0.2.1
  ├─┬ mapnik@3.5.14
  │ ├── mapnik-vector-tile@1.2.2
  │ ├── nan@2.4.0
  │ ├─┬ node-pre-gyp@0.6.39
  │ │ ├── detect-libc@1.0.3
  │ │ ├─┬ hawk@3.1.3
  │ │ │ ├─┬ boom@2.10.1
  │ │ │ │ └── hoek@2.16.3 deduped
  │ │ │ ├─┬ cryptiles@2.0.5
  │ │ │ │ └── boom@2.10.1 deduped
  │ │ │ ├── hoek@2.16.3
  │ │ │ └─┬ sntp@1.0.9
  │ │ │   └── hoek@2.16.3 deduped
  │ │ ├─┬ mkdirp@0.5.1
  │ │ │ └── minimist@0.0.8
  │ │ ├─┬ nopt@4.0.1
  │ │ │ ├── abbrev@1.1.1
  │ │ │ └─┬ osenv@0.1.5
  │ │ │   ├── os-homedir@1.0.2
  │ │ │   └── os-tmpdir@1.0.2
  │ │ ├─┬ npmlog@4.1.2
  │ │ │ ├─┬ are-we-there-yet@1.1.4
  │ │ │ │ ├── delegates@1.0.0
  │ │ │ │ └── readable-stream@2.3.6 deduped
  │ │ │ ├── console-control-strings@1.1.0
  │ │ │ ├─┬ gauge@2.7.4
  │ │ │ │ ├── aproba@1.2.0
  │ │ │ │ ├── console-control-strings@1.1.0 deduped
  │ │ │ │ ├── has-unicode@2.0.1
  │ │ │ │ ├── object-assign@4.1.1
  │ │ │ │ ├── signal-exit@3.0.2 deduped
  │ │ │ │ ├── string-width@1.0.2 extraneous
  │ │ │ │ ├── strip-ansi@3.0.1 deduped
  │ │ │ │ └─┬ wide-align@1.1.2
  │ │ │ │   └── string-width@1.0.2 extraneous
  │ │ │ └── set-blocking@2.0.0 deduped
  │ │ ├─┬ rc@1.2.6
  │ │ │ ├── deep-extend@0.4.2
  │ │ │ ├── ini@1.3.5
  │ │ │ ├── minimist@1.2.0 extraneous
  │ │ │ └── strip-json-comments@2.0.1
  │ │ ├── request@2.81.0 extraneous
  │ │ ├─┬ rimraf@2.6.2
  │ │ │ └─┬ glob@7.1.2
  │ │ │   ├── fs.realpath@1.0.0
  │ │ │   ├─┬ inflight@1.0.6
  │ │ │   │ ├── once@1.4.0 deduped
  │ │ │   │ └── wrappy@1.0.2 deduped
  │ │ │   ├── inherits@2.0.3 deduped
  │ │ │   ├─┬ minimatch@3.0.4
  │ │ │   │ └─┬ brace-expansion@1.1.11
  │ │ │   │   ├── balanced-match@1.0.0
  │ │ │   │   └── concat-map@0.0.1
  │ │ │   ├── once@1.4.0 deduped
  │ │ │   └── path-is-absolute@1.0.1
  │ │ ├── semver@5.5.0 deduped
  │ │ ├─┬ tar@2.2.1
  │ │ │ ├─┬ block-stream@0.0.9
  │ │ │ │ └── inherits@2.0.3 deduped
  │ │ │ ├─┬ fstream@1.0.11
  │ │ │ │ ├── graceful-fs@4.1.11
  │ │ │ │ ├── inherits@2.0.3 deduped
  │ │ │ │ ├── mkdirp@0.5.1 deduped
  │ │ │ │ └── rimraf@2.6.2 deduped
  │ │ │ └── inherits@2.0.3
  │ │ └─┬ tar-pack@3.4.1
  │ │   ├─┬ debug@2.6.9
  │ │   │ └── ms@2.0.0
  │ │   ├── fstream@1.0.11 deduped
  │ │   ├─┬ fstream-ignore@1.0.5
  │ │   │ ├── fstream@1.0.11 deduped
  │ │   │ ├── inherits@2.0.3 deduped
  │ │   │ └── minimatch@3.0.4 deduped
  │ │   ├─┬ once@1.4.0
  │ │   │ └── wrappy@1.0.2
  │ │   ├─┬ readable-stream@2.3.6
  │ │   │ ├── core-util-is@1.0.2
  │ │   │ ├── inherits@2.0.3 deduped
  │ │   │ ├── isarray@1.0.0
  │ │   │ ├── process-nextick-args@2.0.0
  │ │   │ ├── safe-buffer@5.1.1 deduped
  │ │   │ ├─┬ string_decoder@1.1.1
  │ │   │ │ └── safe-buffer@5.1.1 deduped
  │ │   │ └── util-deprecate@1.0.2
  │ │   ├── rimraf@2.6.2 deduped
  │ │   ├── tar@2.2.1 deduped
  │ │   └── uid-number@0.0.6
  │ └── protozero@1.4.5
  ├─┬ mapnik-pool@0.1.3
  │ ├── generic-pool@2.2.2
  │ └── xtend@4.0.1
  ├─┬ nomnom@1.8.1
  │ ├─┬ chalk@0.4.0
  │ │ ├── ansi-styles@1.0.0
  │ │ ├── has-color@0.1.7
  │ │ └── strip-ansi@0.1.1 extraneous
  │ └── underscore@1.6.0
  ├─┬ npm@4.6.1
  │ ├── abbrev@1.1.0 extraneous
  │ ├── ansi-regex@2.1.1 extraneous
  │ ├── ansicolors@0.3.2 extraneous
  │ ├── ansistyles@0.1.3 extraneous
  │ ├── aproba@1.1.1 extraneous
  │ ├── archy@1.0.0 extraneous
  │ ├── asap@2.0.5 extraneous
  │ ├── bluebird@3.5.0 extraneous
  │ ├── call-limit@1.1.0 extraneous
  │ ├── chownr@1.0.1 extraneous
  │ ├── cmd-shim@2.0.2 extraneous
  │ ├── columnify@1.5.4 extraneous
  │ ├── config-chain@1.1.11 extraneous
  │ ├── debuglog@1.0.1 extraneous
  │ ├── dezalgo@1.0.3 extraneous
  │ ├── editor@1.0.0 extraneous
  │ ├── fs-vacuum@1.2.10 extraneous
  │ ├── fs-write-stream-atomic@1.0.10 extraneous
  │ ├── fstream@1.0.11 extraneous
  │ ├── fstream-npm@1.2.0 extraneous
  │ ├── glob@7.1.1 extraneous
  │ ├── graceful-fs@4.1.11 extraneous
  │ ├── has-unicode@2.0.1 extraneous
  │ ├── hosted-git-info@2.4.2 extraneous
  │ ├── iferr@0.1.5 extraneous
  │ ├── imurmurhash@0.1.4 extraneous
  │ ├── inflight@1.0.6 extraneous
  │ ├── inherits@2.0.3 extraneous
  │ ├── ini@1.3.4 extraneous
  │ ├── init-package-json@1.10.1 extraneous
  │ ├── JSONStream@1.3.1 extraneous
  │ ├── lazy-property@1.0.0 extraneous
  │ ├── lockfile@1.0.3 extraneous
  │ ├── lodash._baseindexof@3.1.0 extraneous
  │ ├── lodash._baseuniq@4.6.0 extraneous
  │ ├── lodash._bindcallback@3.0.1 extraneous
  │ ├── lodash._cacheindexof@3.0.2 extraneous
  │ ├── lodash._createcache@3.1.2 extraneous
  │ ├── lodash._getnative@3.9.1 extraneous
  │ ├── lodash.clonedeep@4.5.0 extraneous
  │ ├── lodash.restparam@3.6.1 extraneous
  │ ├── lodash.union@4.6.0 extraneous
  │ ├── lodash.uniq@4.5.0 extraneous
  │ ├── lodash.without@4.4.0 extraneous
  │ ├── mississippi@1.3.0 extraneous
  │ ├── mkdirp@0.5.1 extraneous
  │ ├── move-concurrently@1.0.1 extraneous
  │ ├── node-gyp@3.6.0 extraneous
  │ ├── nopt@4.0.1 extraneous
  │ ├── normalize-git-url@3.0.2 extraneous
  │ ├── normalize-package-data@2.3.8 extraneous
  │ ├── npm-cache-filename@1.0.2 extraneous
  │ ├── npm-install-checks@3.0.0 extraneous
  │ ├── npm-package-arg@4.2.1 extraneous
  │ ├── npm-registry-client@8.1.1 extraneous
  │ ├── npm-user-validate@0.1.5 extraneous
  │ ├── npmlog@4.0.2 extraneous
  │ ├── once@1.4.0 extraneous
  │ ├── opener@1.4.3 extraneous
  │ ├── osenv@0.1.4 extraneous
  │ ├── path-is-inside@1.0.2 extraneous
  │ ├── read@1.0.7 extraneous
  │ ├── read-cmd-shim@1.0.1 extraneous
  │ ├── read-installed@4.0.3 extraneous
  │ ├── read-package-json@2.0.5 extraneous
  │ ├── read-package-tree@5.1.5 extraneous
  │ ├── readable-stream@2.2.9 extraneous
  │ ├── readdir-scoped-modules@1.0.2 extraneous
  │ ├── realize-package-specifier@3.0.3 extraneous
  │ ├── request@2.81.0 extraneous
  │ ├── retry@0.10.1 extraneous
  │ ├── rimraf@2.6.1 extraneous
  │ ├── semver@5.3.0 extraneous
  │ ├── sha@2.0.1 extraneous
  │ ├── slide@1.1.6 extraneous
  │ ├── sorted-object@2.0.1 extraneous
  │ ├── sorted-union-stream@2.1.3 extraneous
  │ ├── strip-ansi@3.0.1 extraneous
  │ ├── tar@2.2.1 extraneous
  │ ├── text-table@0.2.0 extraneous
  │ ├── uid-number@0.0.6 extraneous
  │ ├── umask@1.1.0 extraneous
  │ ├── unique-filename@1.1.0 extraneous
  │ ├── unpipe@1.0.0 extraneous
  │ ├── update-notifier@2.1.0 extraneous
  │ ├── uuid@3.0.1 extraneous
  │ ├── validate-npm-package-license@3.0.1 extraneous
  │ ├── validate-npm-package-name@3.0.0 extraneous
  │ ├── which@1.2.14 extraneous
  │ ├── wrappy@1.0.2 extraneous
  │ └── write-file-atomic@1.3.3 extraneous
  ├─┬ request@2.85.0
  │ ├── aws-sign2@0.7.0 extraneous
  │ ├── aws4@1.6.0
  │ ├── caseless@0.12.0
  │ ├─┬ combined-stream@1.0.6
  │ │ └── delayed-stream@1.0.0
  │ ├── extend@3.0.1
  │ ├── forever-agent@0.6.1
  │ ├── form-data@2.3.2 extraneous
  │ ├── har-validator@5.0.3 extraneous
  │ ├── hawk@6.0.2 extraneous
  │ ├── http-signature@1.2.0 extraneous
  │ ├── is-typedarray@1.0.0
  │ ├── isstream@0.1.2
  │ ├── json-stringify-safe@5.0.1
  │ ├─┬ mime-types@2.1.18
  │ │ └── mime-db@1.33.0
  │ ├── oauth-sign@0.8.2
  │ ├── performance-now@2.1.0 extraneous
  │ ├── qs@6.5.1 extraneous
  │ ├── safe-buffer@5.1.1
  │ ├── stringstream@0.0.5
  │ ├─┬ tough-cookie@2.3.4
  │ │ └── punycode@1.4.1
  │ ├─┬ tunnel-agent@0.6.0
  │ │ └── safe-buffer@5.1.1 deduped
  │ └── uuid@3.2.1
  └── semver@5.5.0

also getting this error using node 10.6.0

Same issue with node v9.11.2 😢

EDIT: Maybe #245 is fixing this issue ?! >> CONFIRMED

I think we can close this issue.
What do you think @alexey-gl @Trevirirus ?

@jbelien
It works! Thanks a lot!