From 1bfacd5c831c42fe7d3d50c798d145641ee5154d Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 20 Oct 2026 14:33:39 +0100 Subject: [PATCH] fix: declare that docx needs Node.js 16 or later (#3807) --- docs/quickstart.md | 2 ++ docs/usage/embedded-files.md | 2 +- docs/usage/html.md | 2 +- docs/usage/layout.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/quickstart.md b/docs/quickstart.md index f658eadac7..e72b1bca0a 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -15,6 +15,8 @@ Get up and running with docx in under 5 minutes. npm install --save docx ``` +In Node, docx needs Node.js 16 or later. `docx/html` and `docx/embedded-files` need 16.9 or later, and `docx/layout` 18 or later. + ## Your First Document Create a "Hello World" document in just a few lines: diff --git a/docs/usage/embedded-files.md b/docs/usage/embedded-files.md index 6849312819..a8cde7f0d9 100644 --- a/docs/usage/embedded-files.md +++ b/docs/usage/embedded-files.md @@ -4,7 +4,7 @@ A document can have files embedded in it: a workbook, another document, a presentation, or any other file, such as a sound, a video or a PDF. Each is an OLE object, which the document shows as a picture, and which opens when it is double-clicked, as a file embedded with Word's **Insert > Object > Create from File** does. -`EmbeddedFileRun` embeds a file. It comes with the `docx` package, from `docx/embedded-files`, and goes in a paragraph, as an `ImageRun` does: +`EmbeddedFileRun` embeds a file. It comes with the `docx` package, from `docx/embedded-files` (in Node, Node.js 16.9 or later), and goes in a paragraph, as an `ImageRun` does: ```ts import { Document, Packer, Paragraph } from "docx"; diff --git a/docs/usage/html.md b/docs/usage/html.md index 99acc25f94..98eb2e3b33 100644 --- a/docs/usage/html.md +++ b/docs/usage/html.md @@ -6,7 +6,7 @@ They are for HTML that comes from somewhere else, such as what people write in a rich-text editor and an app keeps, a page of a content management system, or the answer of a language model. For a document you write yourself, docx's own components say what you mean more clearly. -They come with the `docx` package, from `docx/html`. +They come with the `docx` package, from `docx/html`. In Node, they need Node.js 16.9 or later. ## Example diff --git a/docs/usage/layout.md b/docs/usage/layout.md index eda89d9ebd..6cc8c8a780 100644 --- a/docs/usage/layout.md +++ b/docs/usage/layout.md @@ -14,7 +14,7 @@ It can also give what is on each page, with [`layoutDocument`](#what-is-on-each- ## Importing -Layout comes with the `docx` package. Import it from `docx/layout`, and everything else from `docx`: +Layout comes with the `docx` package. Import it from `docx/layout`, and everything else from `docx`. In Node, it needs Node.js 18 or later: ```ts import { Document, TableOfContents } from "docx"; diff --git a/package-lock.json b/package-lock.json index 070e19a55b..c17f47ab99 100644 --- a/package-lock.json +++ b/package-lock.json @@ -61,7 +61,7 @@ "vitest": "^5.0.2" }, "engines": { - "node": ">=10" + "node": ">=16" } }, "node_modules/@aashutoshrathi/word-wrap": { diff --git a/package.json b/package.json index 03612b61af..265feecd5a 100644 --- a/package.json +++ b/package.json @@ -226,6 +226,6 @@ "vitest": "^5.0.2" }, "engines": { - "node": ">=10" + "node": ">=16" } }