aardgoose / CaveView.js

Web native 3d cave survey viewer
https://aardgoose.github.io/CaveView.js/
MIT License
44 stars 11 forks source link

Debian packaging #13

Open wookey opened 6 years ago

wookey commented 6 years ago

I wanted to use this on the server, which means it needs packaging. So I had a go.

Most obvious issue is that it requires three.js v85 and debian only has v80. https://tracker.debian.org/pkg/three.js Could it be made to work with 80, or will I have to use the internal 3.js copy for now?

But so far have not been able to build in debian unstable. Following the build instruction at: https://aardgoose.github.io/CaveView.js/build.html apt install --no-install-recommends rollup npm goes OK but npm init fails with npm ERR! Error: unable to get local issuer certificate npm ERR! at TLSSocket. (_tls_wrap.js:1109:38) npm ERR! at emitNone (events.js:106:13) npm ERR! at TLSSocket.emit (events.js:208:7) npm ERR! at TLSSocket._finishInit (_tls_wrap.js:639:8) npm ERR! at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:469:38) npm ERR! If you need help, you may report this entire log, npm ERR! including the npm and node versions, at: npm ERR! http://github.com/npm/npm/issues

npm ERR! System Linux 4.13.0-45-generic npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" npm ERR! cwd /home/wookey/packages/caveview.js/debian/caveview.js-1.8.0 npm ERR! node -v v8.11.2 npm ERR! npm -v 1.4.21 npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/wookey/packages/caveview.js/debian/caveview.js-1.8.0/npm-debug.log npm ERR! not ok code 0

Node and js world generally is greek to me. So what exactly is the problem there? The log file says: 0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/node', 1 verbose cli '/usr/bin/npm', 1 verbose cli 'view', 1 verbose cli 'CaveView.js', 1 verbose cli '--json' ] 2 info using npm@1.4.21 3 info using node@v8.11.2 4 verbose request where is /CaveView.js 5 verbose request registry https://registry.npmjs.org/ 6 verbose request id 1c4f6b466a66dfcf 7 verbose url raw /CaveView.js 8 verbose url resolving [ 'https://registry.npmjs.org/', './CaveView.js' ] 9 verbose url resolved https://registry.npmjs.org/CaveView.js 10 verbose request where is https://registry.npmjs.org/CaveView.js 11 info trying registry request attempt 1 at 2:00:15 AM 12 http GET https://registry.npmjs.org/CaveView.js 13 info retry will retry, error on last attempt: Error: unable to get local issuer certificate 14 info trying registry request attempt 2 at 2:00:25 AM 15 http GET https://registry.npmjs.org/CaveView.js 16 info retry will retry, error on last attempt: Error: unable to get local issuer certificate 17 info trying registry request attempt 3 at 2:01:25 AM 18 http GET https://registry.npmjs.org/CaveView.js 19 error Error: unable to get local issuer certificate 19 error at TLSSocket. (_tls_wrap.js:1109:38) 19 error at emitNone (events.js:106:13) 19 error at TLSSocket.emit (events.js:208:7) 19 error at TLSSocket._finishInit (_tls_wrap.js:639:8) 19 error at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:469:38) 20 error If you need help, you may report this entire log, 20 error including the npm and node versions, at: 20 error http://github.com/npm/npm/issues 21 error System Linux 4.13.0-45-generic 22 error command "/usr/bin/node" "/usr/bin/npm" "view" "CaveView.js" "--json" 23 error cwd /home/wookey/packages/caveview.js/debian/caveview.js-1.8.0 24 error node -v v8.11.2 25 error npm -v 1.4.21 26 error code UNABLE_TO_GET_ISSUER_CERT_LOCALLY 27 verbose exit [ 1, true ]

AIUI npm dynamically downloads versions of everything needed to build, and this is fundamentally at odds with debian package-build mechanisms which require a build to be possible without internet access. npm2deb is the magic to convert npm rules into debian packaging: https://wiki.debian.org/Javascript/Nodejs/Npm2Deb

Using it to check whether the dependencies are already packaged or not gives the same error as above.

Some googling suggested that this might help: setting npm config set strict-ssl false That changes the error to:

npm ERR! Error: Not found : CaveView.js And indeed: https://registry.npmjs.org/CaveView.js does not exist. Should it? Is there a way to tell npm to get it's info from somewhere else?

I seem to be stuck. Neither your nor debian's build instructions work. I am probably doing something very dim. Suggestions welcome.

A manual inspection suggests that https://github.com/florian/observable is one unpackaged thing.

aardgoose commented 6 years ago

Hi,

My setup probably has some odd dependencies and mistakes that work for me on WIndows but not on Linux.

I would prefer to keep with the later versions of Three.js. I made some changes that were included in r81 and r82 that reduce the heap memory consumption when using Chrome and Firefox, and actually improve performance slightly.

I'll setup a debian VM and have a look.

aardgoose commented 6 years ago

As you have observed the Debian and npm packaging tools have different philosophies and the Debian packages for the various npm packages required are quite out of date.

A major issue is the Debian npm is very old, and won't install/download some of the required dependencies. With the latest version installed 'npm install' from the CaveView directory. now correctly installs the dependencies.

I've sorted out the crude hacking I used to include the x18n and Observable libraries, and removed the copy of the proj4js library. Proj4js is now a dependency and built into the main .js file from its own module..

With these changes 'npm run build' works correctly.

The major hack remaining is I pull code from the Three directories through a shim which only references the Three component files I use instead of through the main Three module top level file which references the complete Three code.

This is a work-around to reduce the size of the built file (about %50), otherwise the rollup tool includes a lot of unused code. This is a known limitation of the static analysis of the code that rolllup carries out..

wookey commented 2 years ago

OK. Things moved on in 4 years and CaveView 1.8.0 now builds on debian stable. Not tried newer versions yet. But they removed libjs-proj4 and libjs-mgrs in the meantime (due to abandonment of js maintenance in GIS team. They both still build (and so does libjs-proj4 2.8.0 which is actually new enough for CaveView 1.8.0). I'll check this stuff all works and if so upload some packages.