Unable to run or build Electron app with WSL
peter-bozovic opened this issue · 0 comments
-
Environment: Windows 11 with Ubuntu 22.04 on WSL 2
-
Dotnet Version: 7
- Electron Version: 23.6.1
- Target: linux
Steps to Reproduce:
- Install/Use Ubuntu 22.04 on WSL
wsl --install -d Ubuntu-22.04
Then within the Linux prompt:
2. Install dotnet 6 (for Electron cli) & dotnet 7 for the project
sudo apt-get update && sudo apt-get install -y dotnet-sdk-6.0 && sudo apt-get install -y dotnet-sdk-7.0
4. Install Electron CLI
dotnet tool install ElectronNET.CLI -g
5. Add path for electronize (copy/paste depending on your user account name)
export PATH="$PATH:/home/{{username}}/.dotnet/tools"
6. Create project folder
mkdir ElectronBuild && cd ElectronBuild
7. Create Blazor Server Project
dotnet new blazorserver
8. Init the Electron config
electronize init
9.a Try to run the app
electronize start
The following error appears at the end:
node_modules missing in: /home/wsl/ElectronBuild/obj/Host/node_modules
Start npm install...
npm install
npm WARN deprecated tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.
npm ERR! code 1
npm ERR! path \\wsl.localhost\Ubuntu-22.04\home\wsl\ElectronBuild\obj\Host\node_modules\electron
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js
npm ERR! '\\wsl.localhost\Ubuntu-22.04\home\wsl\ElectronBuild\obj\Host\node_modules\electron'
npm ERR! CMD.EXE a été démarré avec le chemin d’accès comme répertoire en
npm ERR! cours. Les chemins d’accès UNC ne sont pas prise en charge. Utilisation
npm ERR! du répertoire Windows par défaut.
npm ERR! node:internal/modules/cjs/loader:1078
npm ERR! throw err;
npm ERR! ^
npm ERR!
npm ERR! Error: Cannot find module 'C:\Windows\install.js'
npm ERR! at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
npm ERR! at Module._load (node:internal/modules/cjs/loader:920:27)
npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR! at node:internal/main/run_main_module:23:47 {
npm ERR! code: 'MODULE_NOT_FOUND',
npm ERR! requireStack: []
npm ERR! }
npm ERR!
npm ERR! Node.js v18.15.0
9.b Try to publish the app
electronize build /target linux
The following error appears at the end:
ElectronHostHook handling started...
Build Electron Desktop Application...
Executing electron magic in this directory: /home/wsl/ElectronBuild/bin/desktop
Create electron-builder configuration file...
node build-helper.js electron.manifest.json
bash: line 1: node: command not found
Package Electron App for Platform linux...
npx electron-builder --config=./bin/electron-builder.json --linux --x64 -c.electronVersion=23.2.0
'\\wsl.localhost\Ubuntu-22.04\home\wsl\ElectronBuild\obj\desktop\linux'
CMD.EXE a été démarré avec le chemin d’accès comme répertoire en
cours. Les chemins d’accès UNC ne sont pas prise en charge. Utilisation
du répertoire Windows par défaut.
• electron-builder version=23.0.3 os=10.0.22621
⨯ ENOENT: no such file or directory, open 'C:\Windows\bin\electron-builder.json' failedTask=build stackTrace=Error: ENOENT: no such file or directory, open 'C:\Windows\bin\electron-builder.json'
... done
For some reason, it's using the network path \\wsl.localhost\... as project location and also trying to look for stuff within C:\WINDOWS\... which is of course not accessible within WSL
I don't know if it's the Elecronize CLI issue or the electron builder issue or if there are workarounds on how to make it work ...