Skip to content

v8.0.24: worker/ directory missing from npm package (files field incomplete) #609

@Dennis-SEG

Description

@Dennis-SEG

Bug

Version 8.0.24 fails to load with:

Error: Cannot find module '../worker/index'
Require stack:
- .../node_modules/modbus-serial/apis/worker.js
- .../node_modules/modbus-serial/index.js

Root Cause

The files field was added to package.json in v8.0.24, but "worker" is not included:

"files": [
    "index.js",
    "apis",
    "ports",
    "servers",
    "utils",
    "index.d.ts",
    "ModbusRTU.d.ts",
    "ServerTCP.d.ts",
    "ServerSerial.d.ts",
    "TestPort.d.ts",
    "README.md",
    "LICENSE"
]

apis/worker.js requires ../worker/index, but the worker/ directory is excluded from the published tarball.

Verification

# v8.0.23 - OK
npm pack modbus-serial@8.0.23 && tar tzf modbus-serial-8.0.23.tgz | grep worker
# Output: package/worker/index.js, package/worker/README.md, package/apis/worker.js

# v8.0.24 - BROKEN
npm pack modbus-serial@8.0.24 && tar tzf modbus-serial-8.0.24.tgz | grep worker
# Output: package/apis/worker.js  (worker/index.js is MISSING)

The worker/ directory exists in the GitHub repo but is not packaged.

Fix

Add "worker" to the files array in package.json:

"files": [
    "index.js",
    "apis",
    "ports",
    "servers",
    "utils",
    "worker",
    "index.d.ts",
    ...
]

Impact

This is a breaking regression — any code that uses modbus-serial@8.0.24 (including via ^8.0.x ranges) will fail at require time. All dependents are affected.

Workaround

Pin to 8.0.23:

"modbus-serial": "8.0.23"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions