Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
useHttpClientHints
✓ import { useHttpClientHints } from '#http-client-hints'
✗ import { useHttpClientHints } from 'nuxt-http-client-hints'
The composable is auto-imported; explicit import uses the alias #http-client-hints when module is installed.
defineHttpClientHintsConfig
✓ import { defineHttpClientHintsConfig } from 'nuxt-http-client-hints'
Available in version >= 0.0.1 for runtime config.
HttpClientHintsPlugin
✓ import { HttpClientHintsPlugin } from 'nuxt-http-client-hints/runtime/plugin'
✗ import { HttpClientHintsPlugin } from 'nuxt-http-client-hints'
Plugin is internal; use the module's Nuxt module setup instead of plugin directly.
Shows Nuxt module registration and usage of useHttpClientHints composable and server-side header access.
// Module registration in nuxt.config.ts
export default defineNuxtConfig({
modules: ['nuxt-http-client-hints'],
httpClientHints: {
// Optional: configure client hints to use
deviceMemory: true,
downlink: true,
ect: true,
rtt: true,
secCHPrefersColorScheme: true,
}
})
// In any component/page
const hints = useHttpClientHints()
console.log(hints.deviceMemory) // '4' | '2' | '1' | '0.5' | '0.25' | null
console.log(hints.downlink) // e.g., '10' (Mbps)
console.log(hints.ect) // '4g' | '3g' | '2g' | 'slow-2g' | null
console.log(hints.rtt) // RTT in milliseconds
console.log(hints.secCHPrefersColorScheme) // 'light' | 'dark' | null
// Server-side usage via event
// In server/api or server middleware
export default defineEventHandler(async (event) => {
// Access client hints from request headers
const deviceMemory = getRequestHeader(event, 'Device-Memory')
// ...
})
Errors
Common errors & fixes
Cannot find module '#http-client-hints' or its corresponding type declarations.
The module's auto-import pattern may not be recognized by TypeScript without proper Nuxt types generation.
fixRun `nuxi prepare` or `nuxi generate` to generate the Nuxt types. Ensure the module is added to the modules array in nuxt.config.ts.
TypeError: Cannot read properties of null (reading 'deviceMemory')
Client Hints are not sent by the browser, so the composable returns null for all values.
fixCheck for browser support: navigator.userAgentData?.getHighEntropyValues() as fallback. Or wrap usage in null checks.
Nuxt module 'nuxt-http-client-hints' is not compatible with Nuxt 2.
This module only supports Nuxt 3 (v3.x).
fixUpgrade to Nuxt 3 or use an alternative package.
Audit
Dependencies
detect-browser-esrequiredProvides the core browser and OS detection logic for Client Hints