Skip to content

Build From Source

  • node.js 16+
  • npm
  • git
  • GCC
  • pkg-config
  • cmake
  • protoc (protobuf compiler) >= v3.20.0
  • openssl
  • openssl-dev
  • rustup

See the Valkey installation guide to install the Valkey server and CLI.

  1. Terminal window
    sudo apt update -y
    sudo apt install -y git gcc pkg-config openssl libssl-dev unzip cmake python3
    # Install rust
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    source "$HOME/.cargo/env"
    # Check that the Rust compiler is installed
    rustc --version
    Terminal window
    pip3 install ziglang
    cargo install --locked cargo-zigbuild
    Terminal window
    PB_REL="https://github.com/protocolbuffers/protobuf/releases"
    curl -LO $PB_REL/download/v29.1/protoc-29.1-linux-x86_64.zip
    unzip protoc-29.1-linux-x86_64.zip -d $HOME/.local
    export PATH="$PATH:$HOME/.local/bin"
    protoc --version

    Other platform-specific binaries can be found here.

  2. Terminal window
    mkdir -p $HOME/src
    cd $HOME/src
    git clone https://github.com/valkey-io/valkey-glide.git
    cd valkey-glide
  3. Terminal window
    sudo apt install -y nodejs npm
  4. Terminal window
    cd node
    npm i
    cd rust-client
    npm i
    cd ..
  5. Terminal window
    # Release Mode, stripped of all debug symbols.
    # Optimized and minimized binary size.
    npm run build:release

    Once building completed, you’ll find the compiled JavaScript code in the./build-ts folder.

  6. Terminal window
    # Build first (required before testing)
    npm run build
    # Run standard tests (excluding server modules)
    npm test
    # Run tests with debugging options
    npm run test:debug
    # Run minimal tests (faster subset of tests)
    npm run test:minimum
    # Run only server module tests (requires valkey modules)
    npm run test:modules
  7. Integrating the built GLIDE package into your project.

    Section titled “Integrating the built GLIDE package into your project.”

    Add the package to your project using the folder path with:

    Terminal window
    npm install <path to GLIDE>/node
  • If the build fails after running npx tsc because glide-rs isn’t found, check if your npm version is in the range 9.0.0-9.4.1, and if so, upgrade it. 9.4.2 contains a fix to a change introduced in 9.0.0 that is required in order to build the library.