Sudo make install fails
[redacted]@[redacted]-01:~/cockpit-docker$ sudo make install
leads to the following error:
make package-lock.json && NODE_ENV= ./build.js make[1]: Entering directory '/home/[redacted]/cockpit-docker' ./node-modules-fix.sh make[1]: Leaving directory '/home/[redacted]/cockpit-docker' file:///home/[redacted]/cockpit-docker/build.js:15 const esbuild = (await import(useWasm ? 'esbuild-wasm' : 'esbuild')); ^^^^^
SyntaxError: Unexpected reserved word at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18) at async link (internal/modules/esm/module_job.js:42:21) make: *** [Makefile:110: dist/manifest.json] Error 1
Seems to be related to the node version. apt install installs node 12, but I found that node 18 worked without issues.
Simplest way to do this on ubuntu is
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
nvm install 18
Then re-run the make command.