Registry / http-networking / node-opcua-nodeset-ua

node-opcua-nodeset-ua

JSON →
library2.169.0jsnpmunverified

The `node-opcua-nodeset-ua` package is a core component of the `node-opcua` SDK, providing the standard OPC UA NodeSet XML definitions. These definitions are essential for building OPC UA servers that expose a semantically rich address space conforming to the OPC UA Unified Architecture specification. As part of the highly active `node-opcua` monorepo, it receives frequent updates, typically bi-weekly, aligning with the project's 'Perpetual Beta' model. The current stable version is 2.169.0. Key differentiators for the `node-opcua` ecosystem, including this module, include its pure Node.js implementation, extensive TypeScript support, and a focus on industrial IoT (IIoT) and Machine-to-Machine (M2M) communication. It allows developers to load standard and custom information models into an OPC UA server's address space for robust data exposure.

npm install node-opcua-nodeset-ua
INSTALL
IMPORT
SIG · NODE-OPCUA-NODESET
N
node-opcua-nodeset-ua
http-networkingjavascriptv2.169.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.

standardNodeSet2
import { standardNodeSet2 } from 'node-opcua-nodeset-ua';
const standardNodeSet2 = require('node-opcua-nodeset-ua').StandardNodeSet2;
This named import provides the XML string for the core OPC UA NodeSet (version 2). It is commonly used to initialize an OPC UA server's address space. `node-opcua` is primarily an ESM-first library with TypeScript definitions.
standardNodeSet2Filename
import { standardNodeSet2Filename } from 'node-opcua-nodeset-ua';
Provides the filesystem path to the `Opc.Ua.NodeSet2.xml` file, useful when `loadUAModel` or similar functions expect a file path instead of the content itself.
nodesets
import * as nodesets from 'node-opcua-nodeset-ua';
Imports all exports from the `node-opcua-nodeset-ua` module as a namespace, allowing access to various NodeSet versions or utilities if exposed. For example, `nodesets.standardNodeSet2`.

Demonstrates how to set up a basic OPC UA server and load the standard NodeSet 2.0 information model using `node-opcua-nodeset-ua` to establish a foundational address space.

import { OPCUAServer } from 'node-opcua-server'; import { standardNodeSet2 } from 'node-opcua-nodeset-ua'; async function main() { // Create an OPC UA Server instance const server = new OPCUAServer({ port: 4840, // Default OPC UA port resourcePath: '/UA/MyNodeSetServer', buildInfo: { productName: 'NodeSet Example Server', buildNumber: '1', buildDate: new Date(), }, }); // Initialize the server await server.initialize(); console.log('Server initialized.'); // Load the standard OPC UA NodeSet (version 2) into the server's address space // The `standardNodeSet2` export provides the XML content as a string. await server.loadUAModel({ nodeset_filename: [standardNodeSet2], // Pass the NodeSet XML string here }); console.log('Standard NodeSet2 loaded.'); // Optionally, extend the address space with custom objects or variables const addressSpace = server.engine.addressSpace; if (addressSpace) { const objectsFolder = addressSpace.getFolder('ObjectsFolder'); const myDeviceFolder = objectsFolder?.addFolder({ browseName: 'MyCustomDevices', displayName: 'My Custom Devices', }); myDeviceFolder?.addVariable({ browseName: 'Temperature', dataType: 'Double', value: { get: () => new server.variant({ dataType: server.DataType.Double, value: 25.5 }) }, }); } console.log('Custom objects added to address space.'); // Start the server await server.start(); console.log(`Server is now listening on port ${server.port}`); console.log(`Server discovery URL: ${server.getEndpointUrl()}`); console.log('Press Ctrl+C to stop the server.'); // Handle server shutdown on SIGINT process.on('SIGINT', async () => { console.log('Shutting down server...'); await server.shutdown(); console.log('Server shut down.'); process.exit(0); }); } main().catch(console.error);
Debug
Known issues
breakingVersion 2.168.0 introduced a full migration of core packages from `async`/`lodash` to native modern JavaScript patterns. While primarily internal, this could affect users with custom plugins or extensions that directly relied on the removed third-party utilities, potentially causing breaking changes in their integrations.
fix
Review custom code and plugins for direct dependencies on `async` or `lodash` utilities. Refactor to use native JavaScript asynchronous patterns (e.g., `Promise`, `async/await`) and built-in array/object methods.
affects: >=2.168.0
breakingWith version 2.163.0, `node-opcua` finalized full support for OPC UA 1.05 subtyped structures and unions, coupled with a major overhaul of DataType handling. This significant change might cause issues for existing custom DataType definitions or information models that were implicitly relying on older, less compliant parsing behaviors.
fix
Validate custom NodeSet XML files and DataType definitions against OPC UA 1.05 specifications. Test existing server implementations thoroughly to ensure data types are correctly recognized and handled, especially for complex structures and unions. Consult the `node-opcua` documentation for updated guidance on custom DataType registration.
affects: >=2.163.0
gotchaCertificate management APIs have undergone architectural overhauls and enhancements across several recent versions (e.g., v2.167.0, v2.164.2). Changes to `TrustListClient.addCertificate` and the `OPCUACertificateManager` API, including support for certificate chains, mean that older or non-standard certificate handling logic might behave unexpectedly or require updates.
fix
Review and update certificate management logic in clients and servers. Ensure that `TrustListClient.addCertificate` is used correctly with certificate chains if applicable. Familiarize yourself with the `OPCUACertificateManager` API and best practices for secure certificate handling, including proper PKI setup and trusted/rejected certificate store management.
affects: >=2.164.2
gotchaIntroduced in v2.165.0, 'Advertised Endpoints' are crucial for correct operation in environments like Docker, behind NAT, or reverse proxies. Failure to properly configure advertised endpoints will lead to clients being unable to connect or discover the server correctly, as the internal network address may be exposed instead of the external one.
fix
When deploying `node-opcua` servers in containerized or proxied environments, explicitly configure the `advertisedEndpoints` option in the `OPCUAServer` constructor to reflect the externally accessible URLs. This ensures clients receive the correct network information for connection. 
affects: >=2.165.0
gotchaThe `node-opcua` client (since v2.123.0) now displays a warning `[NODE-OPCUA-W33]` if a significant time discrepancy (over 5 seconds) exists between the client and server clocks. While not strictly a breaking error, significant time differences can lead to security token renewal issues and unexpected disconnections in secure channels.
fix
Ensure that both OPC UA client and server machines have their system clocks synchronized, ideally using NTP (Network Time Protocol). Address any `[NODE-OPCUA-W33]` warnings by rectifying time discrepancies to prevent potential connection instability.
affects: >=2.123.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module ... not supported
Attempting to use `require()` to import `node-opcua-nodeset-ua` or other `node-opcua` modules in a CommonJS context, while the library is primarily designed for ES Modules.
fix
Convert your project or specific files to ES Modules by adding `"type": "module"` to your `package.json` or by using `.mjs` file extensions. Then, use `import { standardNodeSet2 } from 'node-opcua-nodeset-ua';` syntax. If a mixed environment is required, consider dynamic `import()` or a build step to transpile to CommonJS if strictly necessary.
Bad_SecurityChecksFailed: The X.509 certificate is not trusted.
The OPC UA client or server has received a certificate from its peer that is not present in its trusted certificate store (PKI/trusted/certs folder) or is otherwise invalid/untrusted.
fix
Ensure the peer's certificate (or its Certificate Authority's certificate) is correctly placed in the `trusted/certs` directory of your client's/server's PKI store. For self-signed certificates, both sides typically need to trust the other's certificate. Verify certificate dates and revocation status. `node-opcua` provides tools (e.g., `node-opcua-pki`) to manage certificates.
Cannot find name 'standardNodeSet2'.
The `standardNodeSet2` symbol (or similar NodeSet export) is either misspelled, or the import statement is incorrect, or the module structure has changed in an unexpected version.
fix
Verify the exact symbol name and the import path. The common import is `import { standardNodeSet2 } from 'node-opcua-nodeset-ua';`. Check the `node-opcua-nodeset-ua` package for available exports in your installed version. If using older `node-opcua` versions, the export name or module structure might differ.
[node-opcua] Cannot load nodeset '...' : file not found or invalid XML format.
The NodeSet XML file provided to `server.loadUAModel()` is either missing, has an incorrect path, or contains malformed XML that prevents parsing. This can also occur if the file is ASCII-encoded when UTF-8 is expected.
fix
Double-check the file path provided to `nodeset_filename`. Ensure the XML file is valid and correctly formatted, typically UTF-8 encoded, and accessible by the Node.js process. Tools like XML validators can help diagnose malformed files.
Upgrade
Version history
2.169.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
node-opcua-nodeset-ua — npm install node-opcua-nodeset-ua · libregistry