Registry / http-networking / default-user-agent

default-user-agent

JSON →
library1.0.0jsnpmunverified

Generates a default User-Agent string for Node.js HTTP requests. Version 1.0.0 is stable but unmaintained since 2015. It outputs strings like 'Node.js/<version> (<os>; <arch>)' and accepts optional app name and version (e.g., 'urllib/0.0.1 Node.js/...'). Unlike modern packages like 'useragent' or 'ua-parser-js', it only generates a string and has no parsing capabilities. Works with Node >=0.10.0. No releases or updates in the last 9 years.

npm install default-user-agent
INSTALL
IMPORT
SIG · DEFAULT-USER-AGENT
D
default-user-agent
http-networkingjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const ua = require('default-user-agent');
import ua from 'default-user-agent';
This package is written in CommonJS and does not provide ESM exports. If using ESM, use createRequire or dynamic import.

Shows how to generate a User-Agent string with and without custom app name/version.

const ua = require('default-user-agent'); // Generate default user-agent console.log(ua()); // e.g., 'Node.js/14.17.0 (OS X 10.15; x64)' // Generate with custom app name and version console.log(ua('myapp', '1.2.3')); // 'myapp/1.2.3 Node.js/14.17.0 (OS X 10.15; x64)'
Debug
Known issues
deprecatedPackage has no releases since 2015; issues and pull requests not addressed.
fix
Consider using a maintained alternative like 'useragent' or manually constructing the User-Agent string.
affects: >=0.0.0
breakingIn Node.js versions older than 0.10.0, the package may not work due to engine requirement.
fix
Upgrade Node.js to >=0.10.0.
affects: <0.10.0
Errors
Common errors & fixes
Cannot find module 'default-user-agent'
Package not installed or not in node_modules.
fix
Run 'npm install default-user-agent' to install it.
TypeError: ua is not a function
Incorrect import pattern, e.g., using import default export in ESM project incorrectly.
fix
Use CommonJS require: const ua = require('default-user-agent');
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
os-nameoptionalused to get the OS name (e.g., 'OS X Yosemite') from the platform release
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
default-user-agent — npm install default-user-agent · libregistry