Files
2026-06-26 21:12:42 +08:00

2.8 KiB

English | 中文

Get the source code

  • git clone git@github.com:siyuan-note/siyuan.git
  • Switch to dev branch git checkout dev

NPM dependencies

Install pnpm: npm install -g pnpm@11.9.0

For China mainland

Set the Electron mirror environment variable and install Electron:

  • macOS/Linux: ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@42.5.0 -D
  • Windows:
    • SET ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/
    • pnpm install electron@42.5.0 -D

NPM mirror:

  • Use npmmirror China mirror repository pnpm --registry https://registry.npmmirror.com/ i
  • Revert to using official repository pnpm --registry https://registry.npmjs.org i

Enter the app folder and execute:

  • pnpm install electron@42.5.0 -D
  • pnpm run install:electron
  • pnpm run dev
  • pnpm run start

Note: Electron 42 no longer downloads its binary automatically during pnpm install. Run pnpm run install:electron (or set ELECTRON_MIRROR first on China mainland) to fetch the binary before pnpm run start.

Note: In the development environment, the kernel process will not be automatically started, and you need to manually start the kernel process first.

Kernel

  1. Install the latest version of golang
  2. Open CGO support, that is, configure the environment variable CGO_ENABLED=1

Desktop

  • cd kernel
  • Windows: go build -tags "fts5" -o "../app/kernel/SiYuan-Kernel.exe"
  • Linux/macOS: go build -tags "fts5" -o "../app/kernel/SiYuan-Kernel"
  • cd ../app/kernel
  • Windows: ./SiYuan-Kernel.exe serve --mode=dev
  • Linux/macOS: ./SiYuan-Kernel serve --mode=dev

iOS

Android

Harmony

Only support compilation under Linux, need to install Harmony SDK, and need to modify Go source code.

Modify Go source code:

  1. go/src/runtime/vim tls_arm64.s

    Change the ending DATA runtime·tls_g+0(SB)/8, $16 to DATA runtime·tls_g+0(SB)/8, $-144

  2. go/src/runtime/cgo/gcc_android.c

    Clear the inittls function

    inittls(void **tlsg, void **tlsbase)
    {
      return;
    }
    
  3. go/src/net/cgo_resold.go C.size_t(len(b)) to C.socklen_t(len(b))

For other details, please refer to https://github.com/siyuan-note/siyuan/issues/13184