Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm package bundles node_modules? #651

Closed
jablko opened this issue Feb 18, 2022 · 3 comments
Closed

npm package bundles node_modules? #651

jablko opened this issue Feb 18, 2022 · 3 comments

Comments

@jablko
Copy link

jablko commented Feb 18, 2022

I noticed that some versions' npm package bundles a node_modules directory, e.g.

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 ...

@sindresorhus
Copy link
Member

More context here: #624 In short, it's needed to work around npm bugs.

@sindresorhus
Copy link
Member

I'm also getting an error installing an XO dependant with npm 7:

Probably better to bring this up on the npm issue tracker.

@jablko
Copy link
Author

jablko commented Feb 18, 2022

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, presumably typescript@4.5.5 -> node_modules/xo/node_modules/typescript? and fails.
      • xo doesn't bundle typescript
      • node_modules/xo/node_modules/typescript/bin/tsc should exist?

I tried summarizing on the npm issue tracker: npm/cli#4441

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants