eemeli/yaml

Seemingly not all files published?

Closed this issue · 5 comments

Describe the bug

import of a file that doesn't exist (I don' see ../doc/directives' relative to composer)

node:internal/modules/cjs/loader:1147
  throw err;
  ^

Error: Cannot find module '../doc/directives.js'
Require stack:
- /myfolder/node_modules/patch-package/node_modules/yaml/dist/compose/composer.js
- /myfolder/node_modules/patch-package/node_modules/yaml/dist/index.js
- /myfolder/node_modules/patch-package/dist/getPackageResolution.js
- /myfolder/node_modules/patch-package/dist/makePatch.js
- /myfolder/node_modules/patch-package/dist/applyPatches.js
- /myfolder/node_modules/patch-package/dist/index.js
- /myfolder/node_modules/patch-package/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/myfolder/node_modules/patch-package/node_modules/yaml/dist/compose/composer.js:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/myfolder/node_modules/patch-package/node_modules/yaml/dist/compose/composer.js',
    '/myfolder/node_modules/patch-package/node_modules/yaml/dist/index.js',
    '/myfolder/node_modules/patch-package/dist/getPackageResolution.js',
    '/myfolder/node_modules/patch-package/dist/makePatch.js',
    '/myfolder/node_modules/patch-package/dist/applyPatches.js',
    '/myfolder/node_modules/patch-package/dist/index.js',
    '/myfolder/node_modules/patch-package/index.js'
  ]
}

Node.js v20.10.0
✨  Done in 0.46s.

To Reproduce

I haven't yet tried to reproduce it myself, as I don't know where it's used, but I used patch-package 8.0.0, which uses yaml 2.4.0

Expected behaviour

No error / all files exist

Versions (please complete the following information):

  • Environment: Node 20.10.0
  • yaml: 2.4.0

Additional context

Using yaml through patch-package

Screenshot 2024-03-01 at 11 58 26

Still not too sure what's going on as this is in my local node_modules, but actually on npm (the website) those files do seem to exist

Screenshot 2024-03-01 at 11 59 07

Using yaml through patch-package

This is the source of your problems; this is a dupe of #384.

You are using a tool that is using broken heuristics to mangle your node_modules contents, and you probably shouldn't.

Ah, sorry, it could be that it's not patch-package but some other tool that's mangling your node_modules.

Hm yes it's probably another tool that removes this folder. Not sure what it is. I'll work around it for now by using a lower version, but keep this in account when I do need to update.

Thanks!

I found it, in the end it's also the "default" .yarnclean in the project I was contributing to that removes the folder. Not sure if that can be modified, but at least I know the parts to tweak when needed.