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"
Bug
Version 8.0.24 fails to load with:
Root Cause
The
filesfield was added topackage.jsonin v8.0.24, but"worker"is not included:apis/worker.jsrequires../worker/index, but theworker/directory is excluded from the published tarball.Verification
The
worker/directory exists in the GitHub repo but is not packaged.Fix
Add
"worker"to thefilesarray inpackage.json:Impact
This is a breaking regression — any code that uses
modbus-serial@8.0.24(including via^8.0.xranges) will fail at require time. All dependents are affected.Workaround
Pin to
8.0.23: