I have simple nodejs project, i am trying to build its snap application but getting issues, first of all, what i did,
1) Installed CtrlX works, installed and run virtual enviorment
2) Then create ctrlX CORE App build enviorement and started,
3) Using Remote SSH for vscode. and created nodejs application. npm installÂ
4) then create snapcraft.yaml describe below, then try to make its by run task build -> amd64
5) it takes more than 8 hours but process is on-going, screen shot attached.
Plus i have also build an snap application of helloworld example available in ctrlx-automation-sdk folder but that provide me built fine,Â
here is my snapcraft.yamlÂ
version: "1.0.0"
name: node-express-app
summary: Node.js Express Application.
description: |
 This is a description of your Node.js Express application.
confinement: strict
grade: devel
base: core22
type: app
apps:
 app:
  command: app.js
  daemon: simple
  plugs:
   - node
  restart-condition: always
  passthrough:
   restart-delay: 10s Â
parts:
 app:
  source: src
  build-environment:
   # Set the node version here. We recommend using the latest LTS version.
   - NODE_VERSION: "18.17.0"
  plugin: npm
  override-build: |
   # set target arch
   if [ $SNAPCRAFT_TARGET_ARCH == "arm64" ]; then
     arch="arm64"
   else
     arch="x64"
   fi
   # fetch node
   node_uri="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${arch}.tar.gz"
   echo fetching: $node_uri
   if [ ! -f "${SNAPCRAFT_PART_INSTALL}/bin/node" ]; then
     curl $node_uri | tar xzf - -C $SNAPCRAFT_PART_INSTALL/ --no-same-owner --strip-components=1
   fi
   npm install --ignore-scripts --no-fund --unsafe-perm
   node app.js
 Â
   npm install -g --prefix $SNAPCRAFT_PART_INSTALL $(npm pack . | tail -1) --ignore-scripts --omit=dev --no-fund --unsafe-perm
   # remove unused node_modules
   rm -rf ${SNAPCRAFT_PART_INSTALL}/lib/node_modules/npm
   rm -rf ${SNAPCRAFT_PART_INSTALL}/lib/node_modules/corepack