{"id":16277,"library":"wordnet-db","title":"WordNet Database Files for Node.js","description":"wordnet-db is a specialized Node.js package designed to provide the complete database files for WordNet 3.1 directly within an npm installation. Currently at version 3.1.14, it offers a robust solution for developers requiring offline access to the Princeton WordNet lexical database, which is particularly useful for natural language processing libraries like `wordpos` and `natural`. The package differentiates itself by pre-bundling the entire 34 MB uncompressed WordNet dictionary, eliminating the need for on-demand downloads or complex setup scripts during application runtime. Its release cadence is primarily reactive, addressing compatibility with newer Node.js versions, fixing installation-related issues, or updating to newer WordNet database versions (though it has been stable on WordNet 3.1 for a while). This ensures that applications can deploy with a guaranteed, self-contained WordNet data source, even in environments with restricted internet access.","status":"active","version":"3.1.14","language":"javascript","source_language":"en","source_url":"git://github.com/moos/wordnet-db","tags":["javascript","WordNet","wordpos","natural","pos"],"install":[{"cmd":"npm install wordnet-db","lang":"bash","label":"npm"},{"cmd":"yarn add wordnet-db","lang":"bash","label":"yarn"},{"cmd":"pnpm add wordnet-db","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS-only. ES modules import syntax will fail.","wrong":"import wordnetDb from 'wordnet-db';","symbol":"wordnetDb","correct":"const wordnetDb = require('wordnet-db');"},{"note":"Properties like `path`, `files`, `version`, and `libVersion` are accessed directly from the default export object.","wrong":"import { path as dbPath } from 'wordnet-db';","symbol":"dbPath","correct":"const dbPath = require('wordnet-db').path;"},{"note":"While object destructuring works with `require`, direct property access is the idiomatic way shown in documentation for this package.","wrong":"const { version: dbVersion } = require('wordnet-db');","symbol":"dbVersion","correct":"const dbVersion = require('wordnet-db').version;"}],"quickstart":{"code":"const wordnetDb = require('wordnet-db');\nconst fs = require('fs');\nconst path = require('path');\n\nconsole.log('--- WordNet DB Information ---');\nconsole.log(`Package version: ${wordnetDb.libVersion}`);\nconsole.log(`WordNet data version: ${wordnetDb.version}`);\nconsole.log(`Database files path: ${wordnetDb.path}`);\nconsole.log(`Number of files: ${wordnetDb.files.length}`);\n\n// Verify a common WordNet data file exists\nconst exampleFile = 'data.noun';\nconst fullPath = path.join(wordnetDb.path, exampleFile);\n\nconsole.log(`\\nChecking for existence of \"${exampleFile}\" at \"${fullPath}\"...`);\n\ntry {\n  fs.accessSync(fullPath, fs.constants.F_OK);\n  console.log(`SUCCESS: \"${exampleFile}\" found. WordNet database seems correctly installed.`);\n\n  // Optionally, read a few lines to confirm content\n  const content = fs.readFileSync(fullPath, 'utf8');\n  console.log(`First 3 lines of ${exampleFile}:\\n${content.split('\\n').slice(0, 3).join('\\n')}`);\n\n} catch (err) {\n  console.error(`ERROR: \"${exampleFile}\" not found or inaccessible. Installation may be incomplete or corrupted.`);\n  console.error(err.message);\n}","lang":"javascript","description":"This script demonstrates how to import `wordnet-db`, access its properties (like path and versions), and verify the presence and content of a sample WordNet data file."},"warnings":[{"fix":"Update `package.json` dependencies and all `require()` statements from `WNdb` to `wordnet-db`.","message":"The package name was changed from `WNdb` to `wordnet-db` to comply with npm naming rules. While old links might still resolve, all new installations and references should use `wordnet-db`.","severity":"breaking","affected_versions":">=3.1.2"},{"fix":"Ensure your Node.js environment is version 0.6.0 or higher. For modern applications, use the latest LTS Node.js release.","message":"Older Node.js versions (specifically <0.6) are not supported due to the package's internal reliance on Node.js's built-in `zlib` module for handling compressed data.","severity":"gotcha","affected_versions":"<3.0.1"},{"fix":"No direct fix needed for newer versions, as it simplifies installation. If you encounter `tar` related errors on older versions, upgrade to `wordnet-db@^3.1.13`.","message":"The method of database file distribution and installation changed significantly. In versions prior to `3.1.12`, a `tar` dependency was used. From `3.1.12` onwards, `tar` was removed, and from `3.1.13`, the `.tar.gz` archive was removed from the npm package, with dictionary files included directly. This affects installation logic and potential `tar` related issues.","severity":"breaking","affected_versions":">=3.1.12"},{"fix":"Before cloning the repository on Windows for version 3.0.0, execute `git config core.autocrlf false` to prevent CRLF conversions that can damage data files.","message":"On Windows systems, if you are working with WordNet 3.0.0 directly from a git clone, automatic CRLF (Carriage Return Line Feed) conversion can corrupt the data files. This was relevant when text dict files were included uncompressed.","severity":"gotcha","affected_versions":"3.0.0"},{"fix":"If experiencing installation issues with `npm@5` on older versions, upgrade to `wordnet-db@^3.1.6` or later.","message":"Installation issues were reported with `npm@5` due to postinstall script order. Version `3.1.6` introduced a fix by including `dict` files directly and disabling the postinstall script.","severity":"gotcha","affected_versions":"~3.1.4 - 3.1.5"}],"env_vars":null,"search_vec":"'3.1':23,123 '3.1.14':32 '34':72 'access':42,148 'address':98 'applic':90,130 'bundl':69 'cadenc':94 'compat':99 'complet':18 'complex':86 'contain':138 'current':29 'data':140 'databas':2,19,48,114 'db':8 'demand':83 'deploy':132 'design':14 'develop':39 'dictionari':76 'differenti':64 'direct':24 'download':84 'elimin':77 'ensur':128 'entir':71 'environ':144 'even':142 'file':3,20 'fix':104 'guarante':135 'instal':28,106 'installation-rel':105 'internet':147 'issu':108 'javascript':149 'languag':55 'lexic':47 'librari':57 'like':58 'mb':73 'natur':54,61,152 'need':79 'newer':101,112 'node.js':5,12,102 'npm':27 'offer':34 'offlin':41 'on-demand':81 'packag':13,63 'particular':51 'pos':153 'pre':68 'pre-bundl':67 'primarili':96 'princeton':45 'process':56 'provid':16 'reactiv':97 'relat':107 'releas':93 'requir':40 'restrict':146 'robust':36 'runtim':91 'script':88 'self':137 'self-contain':136 'setup':87 'solut':37 'sourc':141 'special':11 'stabl':120 'though':116 'uncompress':74 'updat':110 'use':52 'version':31,103,115 'within':25 'wordnet':1,7,22,46,75,113,122,139,150 'wordnet-db':6 'wordpo':59,151","created_at":"2026-04-21T19:19:11.679146+00:00","updated_at":"2026-04-21T19:19:11.679146+00:00","problems":[{"fix":"Upgrade to `wordnet-db@^3.1.13` to use the version where `tar` is no longer a dependency and dictionary files are directly bundled.","cause":"An older version of `wordnet-db` was installed which had `tar` as a runtime dependency, and `tar` failed to install correctly.","error":"Error: Cannot find module 'tar'"},{"fix":"For version `3.0.0` specifically, ensure `git config core.autocrlf false` is set before cloning the repository. For later versions (3.1.x), this issue is largely mitigated by how files are packaged.","cause":"When using `wordnet-db@3.0.0` or cloning the repository directly, Git's `core.autocrlf` setting on Windows converted line endings in the plain text data files, corrupting them.","error":"WordNet data files appear corrupted or have incorrect line endings on Windows."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"http://wordnet.princeton.edu/","github":"https://github.com/moos/wordnet-db","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/wordnet-db","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-20","install_tag":null}}