@@ -103,6 +103,47 @@ If this flag is passed, the behavior can still be set to not abort through
103103[ ` process.setUncaughtExceptionCaptureCallback() ` ] [ ] (and through usage of the
104104` node:domain ` module that uses it).
105105
106+ ### ` --allow-addons `
107+
108+ <!-- YAML
109+ added: REPLACEME
110+ -->
111+
112+ > Stability: 1.1 - Active development
113+
114+ When using the [ Permission Model] [ ] , the process will not be able to use
115+ native addons by default.
116+ Attempts to do so will throw an ` ERR_DLOPEN_DISABLED ` unless the
117+ user explicitly passes the ` --allow-addons ` flag when starting Node.js.
118+
119+ Example:
120+
121+ ``` cjs
122+ // Attempt to require an native addon
123+ require (' nodejs-addon-example' );
124+ ```
125+
126+ ``` console
127+ $ node --experimental-permission --allow-fs-read=* index.js
128+ node:internal/modules/cjs/loader:1319
129+ return process.dlopen(module, path.toNamespacedPath(filename));
130+ ^
131+
132+ Error: Cannot load native addon because loading addons is disabled.
133+ at Module._extensions..node (node:internal/modules/cjs/loader:1319:18)
134+ at Module.load (node:internal/modules/cjs/loader:1091:32)
135+ at Module._load (node:internal/modules/cjs/loader:938:12)
136+ at Module.require (node:internal/modules/cjs/loader:1115:19)
137+ at require (node:internal/modules/helpers:130:18)
138+ at Object.<anonymous> (/home/index.js:1:15)
139+ at Module._compile (node:internal/modules/cjs/loader:1233:14)
140+ at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
141+ at Module.load (node:internal/modules/cjs/loader:1091:32)
142+ at Module._load (node:internal/modules/cjs/loader:938:12) {
143+ code: 'ERR_DLOPEN_DISABLED'
144+ }
145+ ```
146+
106147### ` --allow-child-process `
107148
108149<!-- YAML
@@ -2407,6 +2448,7 @@ Node.js options that are allowed are:
24072448
24082449<!-- node-options-node start -->
24092450
2451+ * ` --allow-addons `
24102452* ` --allow-child-process `
24112453* ` --allow-fs-read `
24122454* ` --allow-fs-write `
0 commit comments