Closed mirtaqi07 closed 6 months ago
*🆕 Untriaged**
The team has not yet reviewed the issue. We usually do it within one business day. Docs: https://github.com/toeverything/AFFiNE/blob/canary/docs/issue-triaging.md
This is an automatic reply by the bot.
Due to some issues on the package manager (hoisting) + electron compatibility issues, the electron build will be done in two stages.
Below is a script that I used for debugging build issues on MacOS. I think you can easily adopt it for windows as well.
#!/bin/bash
echo "step 1: clean up"
find . -name "node_modules" -prune -exec rm -rf '{}' +
# git clean -dfX
git checkout .
build_type=canary
echo "step 2: install web dependencies"
# firstly, build web static
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 SENTRYCLI_SKIP_DOWNLOAD=1 PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 HUSKY=1 yarn
echo "step 3: generate assets"
BUILD_TYPE="$build_type" yarn workspace @affine/electron generate-assets
# cleanup node_modules
find . -name "node_modules" -prune -exec rm -rf '{}' +
echo "step 4: install electron dependencies"
# install electron deps
yarn config set nmHoistingLimits workspaces
yarn config set enableScripts false
yarn config set nmMode classic
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 HUSKY=0 yarn workspaces focus @affine/electron @affine/monorepo
echo "step 5: build native"
# build native
yarn workspace @affine/native build
yarn workspace @affine/storage build
echo "step 6: build electron"
# build electron
yarn workspace @affine/electron build
echo "step 7: package electron"
# package
SKIP_GENERATE_ASSETS=1 BUILD_TYPE="$build_type" HOIST_NODE_MODULES=1 yarn workspace @affine/electron package
Thanks. I've tried cleared all the cache and follow the instructions. At yarn workspace @affine/storage build
,
F:\AFFiNE>yarn workspace @affine/storage build
Compiling cfg-if v1.0.0
Compiling windows_x86_64_msvc v0.48.5
Compiling syn v2.0.38
Compiling libm v0.2.8
Compiling getrandom v0.2.10
Compiling windows-targets v0.48.5
Compiling num-traits v0.2.17
Compiling once_cell v1.18.0
Compiling rand_core v0.6.4
Compiling typenum v1.17.0
Compiling ppv-lite86 v0.2.17
Compiling generic-array v0.14.7
Compiling rand_chacha v0.3.1
Compiling smallvec v1.11.1
Compiling radium v0.7.0
Compiling zerocopy v0.7.31
Compiling serde v1.0.193
Compiling scopeguard v1.2.0
Compiling lock_api v0.4.11
Compiling ahash v0.8.6
Compiling serde_derive v1.0.193
Compiling parking_lot_core v0.9.9
Compiling rand v0.8.5
Compiling windows-sys v0.48.0
Compiling hashbrown v0.14.2
Compiling tap v1.0.1
Compiling wyz v0.5.1
Compiling libloading v0.8.1
Compiling dashmap v5.5.3
Compiling hashbrown v0.13.2
Compiling thiserror-impl v1.0.50
Compiling block-buffer v0.10.4
Compiling crypto-common v0.1.6
Compiling itoa v1.0.9
Compiling pin-project-lite v0.2.13
Compiling num_cpus v1.16.0
Compiling ryu v1.0.15
Compiling memchr v2.6.4
Compiling funty v2.0.0
Compiling minimal-lexical v0.2.1
Compiling thiserror v1.0.50
Compiling bitvec v1.0.1
Compiling nom v7.1.3
Compiling napi-derive-backend v1.0.59
Compiling affine_storage v1.0.0 (F:\AFFiNE\packages\backend\storage)
Compiling tokio v1.34.0
Compiling serde_json v1.0.108
Compiling digest v0.10.7
Compiling lasso v0.7.2
Compiling napi-sys v2.3.0
Compiling nanoid v0.4.0
Compiling rand_distr v0.4.3
Compiling ordered-float v4.1.1
Compiling ctor v0.2.5
Compiling bitflags v2.4.1
Compiling byteorder v1.5.0
Compiling log v0.4.20
Compiling keccak v0.1.4
Compiling smol_str v0.2.1
Compiling napi v2.14.1
Compiling sha3 v0.10.8
Compiling napi-derive v2.15.0
Compiling y-octo v0.0.1 (https://github.com/y-crdt/y-octo.git?branch=main#01ec08ac)
Compiling chrono v0.4.31
error: expected item, found ..
--> packages\backend\storage\src\hashcash.rs:1:1 |
1 | ../../../frontend/native/src/hashcash.rs | ^^ expected item |
---|
= note: for a full list of items that can appear in modules, see https://doc.rust-lang.org/reference/items.html
error: could not compile affine_storage
(lib) due to 1 previous error
Internal Error: Build failed with exit code 101
at ChildProcess.
F:\AFFiNE>
Oh, I forgot that you also need to install rust toolchain and then run yarn workspace @affine/storage build
and yarn workspace @affine/native build
before running make for the electron module
it is installed in my system. Can you plz build in your system and tell me the steps. I'm stuck here for days.
Oh, sorry I missed the log you pasted. The issue here is that on Windows you may need to turn on symlink for git, otherwise packages/backend/storage/src/hashcash.rs
will not be correctly be read from git.
You can turn it on by running
packages/backend/storage/src/hashcash.rs
from your local machinegit config --global core.symlinks true
git checkout packages/backend/storage/src/hashcash.rs
Afterwards you can try build storage
and native
package again.
I've done that, but still the error is same.
F:\AFFiNE>git config --get core.symlinks false
F:\AFFiNE>git checkout packages/backend/storage/src/hashcash.rs Updated 1 path from the index
And do you think that this error could cause the exe upon yarn make
to not open which gives this error.
Sorry, i made a mistake about the git command you should use, which should be git config core.symlinks true
.
After turning symlink on, you can then run git checkout packages/backend/storage/src/hashcash.rs
and try to build storage & native again.
The issue in your screenshot looks like you did not disable hoisting for the packager manager. As I said earlier:
Due to some issues on the package manager (hoisting) + electron compatibility issues, the electron build will be done in two stages.
- build frontend (with default yarn settings)
- build electron (reinstall with hoisting off)
Between each build steps, you have to remove all node_modules (including nested one)
You need to follow https://github.com/toeverything/AFFiNE/issues/6645#issuecomment-2068367804 carefully.
I followed these; the final build didn't give any error, but the app is stuck & displays nothing. Kindly correct me what I've done wrong.
# these to build the frontend
yarn install
yarn run dev
yarn workspace @affine/native build
yarn run dev:electron
# these to build the electron
@echo off
echo step 1: clean up...
for /d /r .\ %%i in (node_modules) do if exist "%%i" rd /s /q "%%i"
git checkout .
set build_type=canary
echo step 2: install web dependencies
set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
set SENTRYCLI_SKIP_DOWNLOAD=1
set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
set HUSKY=1
yarn
echo step 3: generate assets
set BUILD_TYPE=%build_type%
yarn workspace @affine/electron generate-assets
# cleanup node_modules
for /d /r .\ %%i in (node_modules) do if exist "%%i" rd /s /q "%%i"
echo step 4: install electron dependencies
yarn config set nmHoistingLimits workspaces
yarn config set enableScripts false
yarn config set nmMode classic
set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
set HUSKY=0
yarn workspaces focus @affine/electron @affine/monorepo
echo step 5: build native
git config core.symlinks true
git checkout packages/backend/storage/src/hashcash.rs
yarn workspace @affine/native build
yarn workspace @affine/storage build
echo step 6: build electron
yarn workspace @affine/electron build
echo step 7: package electron
set SKIP_GENERATE_ASSETS=1
set BUILD_TYPE=%build_type%
set HOIST_NODE_MODULES=1
yarn workspace @affine/electron package
Initially I got the error at yarn workspace @affine/storage build
while using yarn workspaces focus @affine/electron @affine/monorepo
D:\AFFiNE>yarn workspace @affine/storage build 'napi' is not recognized as an internal or external command, operable program or batch file. command not found: napi
Then I followed the same procedure with yarn add
instead of yarn workspaces focus @affine/electron @affine/monorepo
and didn't get that napi error.
So, at the end, the build was success with yarn workspace @affine/electron package
and it didn't give that previous error on opening the exe. But the software somehow is stuck, and it displays nothing.
@pengx17 I've tried again today from start, but its same; the final app is stuck. I don't know what I'm doing wrong. Kindly help me.
What happened?
I am trying to build the desktop application by running
yarn make
inpackages/frontend/electron
, it builds the artifacts but when I open the exe, following error shows up sayingcan't find electron-updater
butelectron-updater
is in the node modules although theyarn install
was a success. I couldn't figure out, kindly help me to build the desktop app.Distribution version
Windows x64
What browsers are you seeing the problem on if you're using web version?
No response
Are you self-hosting?
Relevant log output
Anything else?
No response