GenieACS Fails to start with Syntax Error


I’ve been trying to get acs-1.2 to build and install in a way that I can tarball it and transplant it to a production server that doesn’t have access to NPM registries or other caches.

Unfortunately I keep running into various issues around NPM packaging, unsafe-permissions, invalid peer dependendencies, dependencies on old libraries (libxmljs2 etc)… or libraries that just aren’t available for FreeBSD.

A common one that I keep experiencing is a syntax error:

# /usr/local/genieacs/bin/genieacs-cwmp
function exitWorkerGracefully(): void {

SyntaxError: Invalid or unexpected token
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)

Any advice and assistance would be appreciated.

~ Rich

Libxmljs is one of the main pain points for many users. Not necessarily because of problems in the library itself (although it hasn’t been updated in a long time) but because it’s a native dependency. Luckily it’s an optional dependency now (and will soon be removed entirely) so you can ignore installation errors pertaining to libxmljs. Actually, go ahead and remove it from package.json and try again.

As for the error you’re getting, it looks like you’re trying to run TypeScript code directly rather than transpile it to JS first. You need to run ‘npm run build’ first and the resulting ‘dist’ directly is what you want to copy to your production environment.