The CLOB Client requires Node.js version 20.10 or higher.Check your Node.js version:
node --version
If you need to upgrade, we recommend using nvm (Node Version Manager):
# Install nvm (if you don't have it)curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash# Install and use Node.js 20nvm install 20nvm use 20
Create a .env file in your project root to store sensitive configuration:
.env
# Wallet ConfigurationPK=your_private_key_without_0x_prefix# Chain Configuration# 137 = Polygon Mainnet# 80002 = Polygon Amoy TestnetCHAIN_ID=137# CLOB API ConfigurationCLOB_API_URL=https://clob.polymarket.com# API Credentials (generate these using the SDK)CLOB_API_KEY=CLOB_SECRET=CLOB_PASS_PHRASE=# Optional: Funder address (usually same as your wallet address for EOA)FUNDER_ADDRESS=
Create a simple test script to verify your installation:
test.ts
import { ClobClient, Chain } from "@polymarket/clob-client";import { config as dotenvConfig } from "dotenv";dotenvConfig();async function test() { // Create a client without authentication for public endpoints const client = new ClobClient("https://clob.polymarket.com", Chain.POLYGON); try { // Test server connectivity const serverTime = await client.getServerTime(); console.log("✓ Server time:", new Date(serverTime)); // Test market data access const markets = await client.getSimplifiedMarkets(); console.log(`✓ Found ${markets.count} markets`); console.log("\n✓ Installation verified successfully!"); } catch (error) { console.error("✗ Installation test failed:", error); }}test();
Run the test:
npx tsx test.ts
You should see output confirming the server time and market count.
Or configure your project to use ES modules by adding "type": "module" to your package.json.
Ethers version conflicts
The CLOB Client requires ethers v5.x. If you have ethers v6 installed, you’ll need to downgrade:
npm install ethers@^5.8.0
Node.js version too old
The package requires Node.js 20.10 or higher. Check your version with node --version and upgrade if necessary using nvm or your system’s package manager.
Axios certificate errors
If you encounter SSL certificate errors, it may be due to corporate proxies or network issues. You can set:
export NODE_TLS_REJECT_UNAUTHORIZED=0
Warning: Only use this in development environments, never in production.