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

astro add causes dev dependencies to be removed from node_modules #8037

Closed
1 task
TheOtterlord opened this issue Aug 11, 2023 · 2 comments · Fixed by #8870
Closed
1 task

astro add causes dev dependencies to be removed from node_modules #8037

TheOtterlord opened this issue Aug 11, 2023 · 2 comments · Fixed by #8870
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: add Related to `astro add` CLI command (scope)

Comments

@TheOtterlord
Copy link
Member

What version of astro are you using?

2.10.5

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Linux

What browser are you using?

Firefox

Describe the Bug

Using astro add causes a weird issue, where any existing installed dev dependencies will be removed from node_modules.

Stackblitz has repro instructions, but here's some you can also use locally.

  1. new project (npm create astro@latest)
  2. install a dev dependency (e.g. npm i daisyui -D)
  3. check it exists in node_modules
  4. use astro add (e.g. npx astro add react -y)
  5. check to find the dev dependency missing from node_modules, but still in the package.json

What's the expected result?

Dev dependencies to still be present, after using astro add.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-3sk8rq?file=md!README.md&on=stackblitz

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Aug 11, 2023
@natemoo-re
Copy link
Member

Thank you for the lovely reproduction, as usual! This is a weird one. I wonder if we're accidentally running npm install in production mode? That's probably the case.

@natemoo-re natemoo-re added - P4: important Violate documented behavior or significantly impacts performance (priority) feat: add Related to `astro add` CLI command (scope) labels Aug 14, 2023
@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Aug 14, 2023
@jacobdalamb
Copy link
Contributor

Thank you for the lovely reproduction, as usual! This is a weird one. I wonder if we're accidentally running npm install in production mode? That's probably the case.

I want to create a PR for this issue and based on what you said, I can't seem to find where this might be happening in the index.ts file of astro add or in install-package.ts file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: add Related to `astro add` CLI command (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants