fix: declare that docx needs Node.js 16 or later (#3807)

This commit is contained in:
Dolan
2026-10-20 14:33:39 +01:00
committed by GitHub
parent 9382d55176
commit 1bfacd5c83
6 changed files with 7 additions and 5 deletions
+2
View File
@@ -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:
+1 -1
View File
@@ -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";
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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";
+1 -1
View File
@@ -61,7 +61,7 @@
"vitest": "^5.0.2"
},
"engines": {
"node": ">=10"
"node": ">=16"
}
},
"node_modules/@aashutoshrathi/word-wrap": {
+1 -1
View File
@@ -226,6 +226,6 @@
"vitest": "^5.0.2"
},
"engines": {
"node": ">=10"
"node": ">=16"
}
}