[email protected]: Missing compiled files in npm package (lib/ directory not included)
Description
The latest version of node-ssh (13.2.1) published on npm is missing the compiled files. The lib/ directory containing the compiled JavaScript files is not included in the npm package, causing ERR_MODULE_NOT_FOUND errors when trying to import the module.
Steps to reproduce
-
Install [email protected]:
npm install [email protected] -
Check the package contents:
ls -la node_modules/node-ssh/ -
Try to import the module:
import { NodeSSH } from 'node-ssh';
Expected behavior
The package should contain:
lib/directory with compiled fileslib/cjs/index.jsfor CommonJS importslib/esm/index.mjsfor ESM imports
Actual behavior
The package only contains:
LICENSE.mdpackage.jsonREADME.md
Missing:
lib/directory and all compiled files
Workaround
Use an older, stable version:
npm install [email protected]
This version includes all necessary compiled files and works correctly.
Environment
- Node.js: v22.14.0
- npm: v10.11.0
- OS: macOS 24.5.0
Additional context
The package.json shows that the package should include compiled files:
{
"main": "lib/cjs/index.js",
"module": "lib/esm/index.mjs",
"exports": {
".": {
"import": "./lib/esm/index.mjs",
"require": "./lib/cjs/index.js"
}
}
}
But these files are not actually included in the published package.
Hello! I've just verified that the files are indeed present in version 13.2.1 in npm from the npm code browser at https://www.npmjs.com/package/node-ssh?activeTab=code
This is just a fly-by comment, given the severity of the report, I had to verify something quickly. I will take a deeper look at this report and come back with any findings
Thank you for your quick reply!
It might be an issue on my end, but just to share some additional context: when I uninstall version 13.2.1 and install version 13.2.0 instead, everything works fine and the lib folder is present as expected.
I’ll double-check my environment, but let me know if there’s anything specific you’d like me to test on my side.
Thanks again!
~/P/t/temp ❯❯❯ tree node_modules/node-ssh
node_modules/node-ssh
├── lib
│ ├── cjs
│ │ └── index.js
│ ├── esm
│ │ └── index.mjs
│ └── typings
│ └── index.d.ts
├── LICENSE.md
├── package.json
└── README.md
5 directories, 6 files
~/P/t/temp ❯❯❯ cat node_modules/node-ssh/package.json | grep version
"version": "13.2.1",
~/P/t/temp ❯❯❯ node Welcome to Node.js v22.17.0.
Type ".help" for more information.
> require('node-ssh')
{ SSHError: [class SSHError extends Error], NodeSSH: [class NodeSSH] }
> x = (await import('node-ssh'))
[Module: null prototype] {
NodeSSH: [class NodeSSH],
SSHError: [class SSHError extends Error]
}
I've been unable to reproduce this
It seemed to be an issue with pnpm on my end; I managed to fix it. Thank you for your quick response.