Registry / devops / electron-installer-snap

electron-installer-snap

JSON →
library5.2.0jsnpmunverified

Builds Snap packages for Electron applications that have already been bundled with electron-packager. Current stable version is 5.2.0, released in 2021 with dependency reductions, TypeScript definitions, and a default confinement change from classic to strict. Requires Node 10+ and snapcraft. Key differentiators: integrates with Electron Forge, autodetects base snap option, and handles Electron sandbox features for Snap confinement.

npm install electron-installer-snap
INSTALL
IMPORT
SIG · ELECTRON-INSTALLER
E
electron-installer-snap
devopsjavascriptv5.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import installer from 'electron-installer-snap'
const installer = require('electron-installer-snap')
ESM-only since v4; use dynamic import or transpile for CJS
createApp
import { createApp } from 'electron-installer-snap'
Named export for advanced use; available since v5 with TypeScript types
SnapcraftConfig
import type { SnapcraftConfig } from 'electron-installer-snap'
import { SnapcraftConfig } from 'electron-installer-snap'
TypeScript-only interface, not a runtime export

Shows how to use the JavaScript API with async/await to create a Snap package from an electron-packager output directory.

import installer from 'electron-installer-snap'; const options = { src: 'out/myappname-linux-x64', dest: 'dist/', arch: 'amd64', name: 'myapp', productName: 'My App', version: '1.0.0', description: 'My Electron App', summary: 'A snap of My App', license: 'Apache-2.0', base: 'core18', confinement: 'strict', grade: 'stable', assumes: ['snapd2.43'], plugs: ['home', 'x11', 'wayland', 'unity7', 'pulseaudio', 'opengl'], slots: [], stages: ['-usr/share/man'], after: [], electronVersion: '11.0.0', snapcraft: '/snap/bin/snapcraft', template: '/path/to/template.snapcraft.yaml', }; async function buildSnap() { try { await installer(options); console.log('Snap package created successfully'); } catch (err) { console.error('Snap creation failed:', err); } } buildSnap();
electron-installer-snap --version
Debug
Known issues
breakingThe default confinement has changed from 'classic' to 'strict' in v5.2.0.
fix
Explicitly set confinement to 'classic' if your app requires classic confinement, or adjust your app to work under strict confinement.
affects: >=5.2.0
breakingCallback-style support was removed in v4.0.0.
fix
Use async/await or util.callbackify() to convert the promise-based API.
affects: >=4.0.0
gotchaNode.js 10 is the minimum required version; Node.js 8 support was dropped in v5.0.0.
fix
Ensure your Node.js version is >= 10.
affects: >=5.0.0
deprecatedThe 'snapcraft' command-line tool must be installed separately and may not be in PATH.
fix
Install snapcraft (e.g., 'sudo snap install snapcraft --classic') and ensure it's available, or specify its path via the 'snapcraft' option.
affects: all
gotchaEINVAL errors often occur when the 'src' path points to an invalid or incomplete Electron app directory.
fix
Verify that 'src' contains the full electron-packager output (with app binary, resources, etc.).
affects: all
gotchaSnap builds may fail if the 'base' option is not set correctly for your Electron version.
fix
Set the 'base' option (e.g., 'core18', 'core20') explicitly or rely on autodetection; check snapcraft requirements.
affects: >=4.1.0
Errors
Common errors & fixes
Error: spawn snapcraft ENOENT
snapcraft is not installed or not in PATH
fix
Install snapcraft: sudo snap install snapcraft --classic
Error: Invalid snap name: my.app (invalid characters)
Snap names must be lowercase alphanumeric with hyphens
fix
Ensure the 'name' option uses only [a-z0-9-]
TypeError: installer is not a function
Using CommonJS require on an ESM-only module
fix
Use import or dynamic import: const installer = (await import('electron-installer-snap')).default
Error: The 'src' directory does not exist: /path/to/nonexistent
Specified src path is incorrect or missing
fix
Run electron-packager first and provide the correct output directory
Upgrade
Version history
5.2.0latest on npm
Audit
Dependencies
snapcraftrequiredRequired to build the .snap package
Agent activity
2 hits · last 30 days
node
2
Resources
electron-installer-snap — npm install electron-installer-snap · libregistry