FACT_core icon indicating copy to clipboard operation
FACT_core copied to clipboard

Use npm instead of manually downloading

Open maringuu opened this issue 2 years ago • 2 comments

The second commit cleans up the .gitignore (and adds src/web_interface/static/node_packages/ to it).

For an alternative branch that uses yarn see static-files-yarn

Closes #827

maringuu avatar Aug 18 '22 14:08 maringuu

Link to failed CI: http://10.71.185.247:10000/job/focal/1865/display/redirect

maringuu avatar Sep 02 '22 10:09 maringuu

@rhelmke When the CI is ready for this this can be merged.

maringuu avatar Sep 08 '22 10:09 maringuu

It seems installing npm from ubuntu's package repository is problematic as the version of node/npm in bionic is ancient: (you can try this very easy and quick with docker, i.e. docker run --rm -it --entrypoint bash -v $(pwd):/work ubuntu:bionic)

root@509c3e678449:/work/web_interface/static# npm install --no-fund .
npm WARN deprecated [email protected]: For the actively supported Angular, see https://www.npmjs.com/package/@angular/core. AngularJS support has officially ended. For extended AngularJS support options, see https://goo.gle/angularjs-path-forward.
npm WARN deprecated [email protected]: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm ERR! Linux 5.15.0-48-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "--no-fund" "."
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code EMISSINGARG

npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror     at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror     at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror     at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror     at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror     at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror     at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror     at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror     at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>
WARN engine [email protected]: wanted: {"node":">=12"} (current: {"node":"8.10.0","npm":"3.5.2"})

npm ERR! Please include the following file with any support request:
npm ERR!     /work/web_interface/static/npm-debug.log

We should probably follow the official installation steps from https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

jstucke avatar Oct 06 '22 15:10 jstucke

We should probably follow the official installation steps from https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

Alternatively we could also use a docker image for the installation: node:alpine3.15 has ~10% of the size of a npm installation under Ubuntu (and also installs/downloads probably faster) and always comes with a modern version.

docker run --rm -v $(pwd)/web_interface/static:/work -u $(id -u):$(id -g) --entrypoint=sh node:alpine3.15 -c "(cd /work ; npm install --no-fund .)"

(or better using the docker helper function)

BTW: it seems the .package-lock.json that was checked in does not match the package.json

jstucke avatar Oct 10 '22 14:10 jstucke

Alternatively we could also use a docker image for the installation

I'm not a huge fan of using docker images to get support for distros whose packages are too old

I added a line to pre_install.sh to add the official node repositorys.

maringuu avatar Oct 13 '22 10:10 maringuu