npm package bundles node_modules?
jablko opened this issue · 3 comments
I noticed that some versions' npm package bundles a node_modules directory, e.g.
- https://unpkg.com/browse/xo@0.46.1/node_modules/
- https://unpkg.com/browse/xo@0.46.3/node_modules/
- https://unpkg.com/browse/xo@0.46.4/node_modules/
- https://unpkg.com/browse/xo@0.47.0/node_modules/
- https://unpkg.com/browse/xo@0.48.0/node_modules/
Versions without node_modules are +/- 11 files and +/- 64 kB vs. versions with are +/- 1,800 files and +/- 6 MB.
I'm also getting an error installing an XO dependant with npm 7:
npm ERR! enoent ENOENT: no such file or directory, chmod '/home/runner/work/remark-lint/remark-lint/node_modules/xo/node_modules/typescript/bin/tsc'
Don't know for sure if the bundled node_modules is the culprit, but it looked unintended. Is it?
I haven't figured out why it's there in some versions and not others. I'd assumed that npm publish
would exclude node_modules. It is listed in .gitignore ...
More context here: #624 In short, it's needed to work around npm bugs.
I'm also getting an error installing an XO dependant with npm 7:
Probably better to bring this up on the npm issue tracker.
Gotcha:
- npm >= 8 (Node.js >= 16) works
- npm <= 6 (Node.js <= 14) without
bundledDependencies
:@typescript-eslint/parser
is hoisted,typescript
isn't ->Cannot find module 'typescript'
100% of the time - npm 7 with
bundledDependencies
:npm ERR! enoent ENOENT: no such file or directory, chmod '/home/runner/work/remark-lint/remark-lint/node_modules/xo/node_modules/typescript/bin/tsc'
- Caused by
bundledDependencies
? Smells like it but unconfirmed. - Under what conditions?
- If you install
xo
,typescript@4.5.5
->node_modules/typescript
and succeeds. - If you install
remark-lint
,typescript@4.4.4
->node_modules/typescript
, presumablytypescript@4.5.5
->node_modules/xo/node_modules/typescript
? and fails. xo
doesn't bundletypescript
node_modules/xo/node_modules/typescript/bin/tsc
should exist?
- If you install
- Caused by
I tried summarizing on the npm issue tracker: npm/cli#4441
Thanks!