ladjs / superagent

Ajax for Node.js and browsers (JS HTTP client). Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
https://ladjs.github.io/superagent/
MIT License
16.59k stars 1.33k forks source link

Cannot find module '...node_modules/debug/src/index.js'. Please verify that the package.json has a valid "main" entry #1545

Closed JasonKleban closed 2 years ago

JasonKleban commented 4 years ago

I'm getting the following error only on a linux servers at runtime on superagent 5.2.2. Works fine locally on windows.

Error: Cannot find module '/wwwroot/app/.../node_modules/superagent/node_modules/debug/src/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:294:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:525:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:781:27)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:849:19)

I notice that debug is a visionmedia npm package too.

I may discover that this is my own boneheaded mistake, but I'm sharing just in case there's a problem with this recent release. Reverting to last-known-good v3.8.2 to see what happens. No breaking changes in the release notes since then are obviously the explanation.

philippnoah commented 4 years ago

Were you able to figure out the cause of the issue?

snuggs commented 2 years ago

@JasonKleban @philippnoah ... because https://github.com/visionmedia/superagent/blob/master/package.json#L115 points to lib/node/index.js instead of src/node/index.js

titanism commented 2 years ago

No, this is correct. The lib folder is built and released on npm.

npm install superagent
cd node_modules/superagent
ls
dist  lib  LICENSE  package.json  README.md