Nodejs App without the Nodejs Plugin

I’m trying to create a snap for a nodejs app but without using the nodejs plugin. The main reason for this is that we have a relatively complicated build behind this that copies several sub-applications together. I’ve created a sample based on this.

files/main.js:

let counter = 0;
setInterval(() => {
    console.log((new Date()).toISOString() + ' logline ' + counter++);
}, 5000);

snapcraft.yaml:

name: testsnapit
version: '0.9'
summary: it Test Snap
description: |
  Test Snap
base: core18
confinement: devmode
grade: devel

parts:
  stage:
    plugin: dump
    source: files/
    stage-snaps:
      - node/14/stable

apps:
  testsnapit:
    command: bin/node --max_old_space_size=70 --lite-mode $SNAP/main.js
    daemon: simple
    plugs: 
      - network
      - network-bind

But I am getting:

...
2020-12-02T23:24:51Z testsnapit.testsnapit[13473]: /snap/testsnapit/x1/command-testsnapit: 2: exec: /snap/testsnapit/x1/bin/node: not found
...
2020-12-02T23:24:52Z systemd[1]: Failed to start Service for snap application testsnapit.testsnapit.

The node snap is built of base core which would mismatch core18. Try rebuilding your snap with base: core.