Building the Zotero Client on Windows

Instructions for Building the Zotero Client assume a POSIX-compliant system capable of handling symbolic links. These instructions will work out-of-the box on most Linux and macOS systems, but Windows requires a few extra steps.

  1. Install Node.JS (a 64-bit release of Node 16 LTS recommended) and Cygwin. During Cygwin setup, in the “Select Packages” step, select the following additional packages to install: “git”, “p7zip”, “python27”, “python3”, “wget”, “zip” and “unzip”.
  2. Run Cygwin Terminal as Administrator (right click → Run as Administrator). Run the following commands in that Cygwin terminal, in a single session.
  3. Force Cygwin to use native windows symlinks:
    export CYGWIN="winsymlinks:nativestrict"
  4. Clone the Zotero source code, Zotero XPI build scripts, and standalone client build scripts. Zotero source code is cloned but not checked out (i.e. no actual files are created):
    git clone --config core.symlinks=true --no-checkout zotero-client
    git clone --recursive
    git clone --recursive
  5. Change to the source code repo, check out required files, and install Node.js modules:
    cd zotero-client
    git checkout HEAD package.json package-lock.json
    npm install
  6. Check out the remaining files, creating valid symbolic links:
    git checkout -f HEAD
    git submodule update --init --recursive

    Note: If you are seeing here errors of the form “error: unable to create symlink […]: Operation not permitted” then you are not running Cygwin as an administrator (see step 2 above).

  7. Fetch “rcedit” (in zotero-standalone-build) which is an additional build dependency on Windows:
     (cd ../zotero-standalone-build && ./scripts/fetch_rcedit)
  8. Now continue with instructions on Building the Zotero Client, beginning with step 3.

Troubleshooting Errors

line 2: $'\r' : command not found

This error is caused by the Cygwin shell misinterpreting Windows line endings in the Node executable. Rerun the Cygwin installer, add the “dos2unix” package, then run:

dos2unix "$(which npm)" "$(which npx)"
dev/client_coding/building_the_standalone_client_windows_notes.txt · Last modified: 2022/07/29 12:29 by abejellinek