alex8088 / quick-start

An easy way to start a front-end project.
MIT License
248 stars 34 forks source link

Electron: Missing X server or $DISPLAY #38

Closed componentscience closed 3 months ago

componentscience commented 3 months ago

Describe the bug

When scaffolding electron apps from scratch on Wayland systems, we have to add the following to our package.json scripts: "start": "electron . --enable-features=UseOzonePlatform --ozone-platform=wayland".

Otherwise it will throw an error: Missing X server or $DISPLAY

How do we add this in electron-vite? We tried adding it to the start line of the solid-ts template and it did not work.

pnpm create @quick-start/electron myapp --template solid-ts

Generates the following package.json:

{ "name": "myapp", "version": "1.0.0", "description": "An Electron application with Solid and TypeScript", "main": "./out/main/index.js", "author": "example.com", "homepage": "https://electron-vite.org", "scripts": { "format": "prettier --write .", "lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix", "typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false", "typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false", "typecheck": "npm run typecheck:node && npm run typecheck:web", "start": "electron-vite preview", "dev": "electron-vite dev", "build": "npm run typecheck && electron-vite build", "postinstall": "electron-builder install-app-deps", "build:unpack": "npm run build && electron-builder --dir", "build:win": "npm run build && electron-builder --win", "build:mac": "electron-vite build && electron-builder --mac", "build:linux": "electron-vite build && electron-builder --linux" }, "dependencies": { "@electron-toolkit/preload": "^3.0.0", "@electron-toolkit/utils": "^3.0.0" }, "devDependencies": { "@electron-toolkit/eslint-config-prettier": "^2.0.0", "@electron-toolkit/eslint-config-ts": "^1.0.1", "@electron-toolkit/tsconfig": "^1.0.1", "@types/node": "^18.19.9", "electron": "^28.2.0", "electron-builder": "^24.9.1", "electron-vite": "^2.0.0", "eslint": "^8.56.0", "eslint-plugin-solid": "^0.13.1", "prettier": "^3.2.4", "solid-js": "^1.8.12", "typescript": "^5.3.3", "vite": "^5.0.12", "vite-plugin-solid": "^2.9.1" } }

Used Scaffolding

create-electron

Used Package Manager

pnpm

Validations

alex8088 commented 3 months ago

https://electron-vite.org/guide/dev#passing-arguments-to-electron-app

componentscience commented 3 months ago

Sorry for overlooking that!