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

Unable to add integrations in pnpm turborepo #8487

Closed
1 task done
atanaskanchev opened this issue Sep 10, 2023 · 11 comments
Closed
1 task done

Unable to add integrations in pnpm turborepo #8487

atanaskanchev opened this issue Sep 10, 2023 · 11 comments
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: add Related to `astro add` CLI command (scope)

Comments

@atanaskanchev
Copy link

Astro Info

Astro                    v3.0.12
Node                     v18.16.1
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

  1. pnpm dlx create-turbo@latest
  2. pnpm create astro@latest
 astro   v3.0.12 Launch sequence initiated.

   dir   Where should we create your new project?
         ./apps/web

  tmpl   How would you like to start your new project?
         Empty
      ✔  Template copied

  deps   Install dependencies?
         No
      ◼  No problem! Remember to install dependencies after setup.

    ts   Do you plan to write TypeScript?
         Yes

   use   How strict should TypeScript be?
         Strictest
      ✔  TypeScript customized

   git   Initialize a new git repository?
         No
      ◼  Sounds good! You can always run git init manually.

  next   Liftoff confirmed. Explore your project!
  1. cd apps/web
  web git:(main) ✗ pnpm astro add react

> [email protected] astro /Users/atanaskanchev/Downloads/astro-integrations-turborepo-pnpm/apps/web
> astro "add" "react"

✔ Resolving packages...

  Astro will run the following command:
  If you skip this step, you can always run it yourself later

 ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮
 │ pnpm add @astrojs/react @types/react-dom@^18.0.6 @types/react@^18.0.21 react-dom@^18.0.0 react@^18.0.0  │
 ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯

✔ Continue? … yes
✖ Installing dependencies...

  ERR_PNPM_INCLUDED_DEPS_CONFLICT  modules directory (at "/Users/atanaskanchev/Downloads/astro-integrations-turborepo-pnpm") was installed with optionalDependencies, dependencies, devDependencies. Current install wants optionalDependencies, dependencies. 

 error   Astro could not update your astro.config.js file safely.
  Reason: Unable to install dependencies
  
  You will need to add these integration(s) manually.
  Documentation: https://docs.astro.build/en/guides/integrations-guide/
  File:
    /Users/atanaskanchev/Downloads/astro-integrations-turborepo-pnpm/node_modules/.pnpm/[email protected]/node_modules/astro/dist/cli/add/index.js:169:31
  Code:
    168 |     case 3 /* failure */: {
    > 169 |       throw createPrettyError(new Error(`Unable to install dependencies`));
          |                               ^
      170 |     }
      171 |   }
      172 |   const rawConfigPath = await resolveConfigPath({
  Stacktrace:
Error: Astro could not update your astro.config.js file safely.
Reason: Unable to install dependencies

You will need to add these integration(s) manually.
Documentation: https://docs.astro.build/en/guides/integrations-guide/
    at add (file:///Users/atanaskanchev/Downloads/astro-integrations-turborepo-pnpm/node_modules/.pnpm/[email protected]/node_modules/astro/dist/cli/add/index.js:169:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runCommand (file:///Users/atanaskanchev/Downloads/astro-integrations-turborepo-pnpm/node_modules/.pnpm/[email protected]/node_modules/astro/dist/cli/index.js:102:7)
    at async cli (file:///Users/atanaskanchev/Downloads/astro-integrations-turborepo-pnpm/node_modules/.pnpm/[email protected]/node_modules/astro/dist/cli/index.js:144:5)

 ELIFECYCLE  Command failed with exit code 1.

What's the expected result?

Should be able to install integrations in turborepo app using pnpm

Link to Minimal Reproducible Example

https://github.com/atanaskanchev/astro-integrations-turborepo-pnpm.git

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 Sep 10, 2023
@ematipico
Copy link
Member

Have you tried to install the dependencies when running create astro? Is there a reason why you decided not to do so?

This may be a legitimate error because @astrojs/react requires astro installed, but you haven't installed it.

@ematipico ematipico added needs response Issue needs response from OP and removed needs triage Issue needs to be triaged labels Sep 11, 2023
@atanaskanchev
Copy link
Author

Have you tried to install the dependencies when running create astro? Is there a reason why you decided not to do so?

This may be a legitimate error because @astrojs/react requires astro installed, but you haven't installed it.

I'm sorry, I do not quite follow. So I first create the app with pnpm create astro@latest. At this point astro dependency is installed. Then I'm using it to add the react integration with pnpm astro add react. Is there a step I am missing?

@ematipico
Copy link
Member

ematipico commented Sep 11, 2023

Looking at the prompt that you pasted, you didn't install the dependencies:

deps Install dependencies?
No
◼ No problem! Remember to install dependencies after setup.

And I think this is the issue. Just a guess.

@atanaskanchev
Copy link
Author

Hi @ematipico unfortunately the same happens regardless of the choice in the Install dependencies? step

➜  astro-integrations-turborepo-pnpm git:(main) ✗ pnpm create astro@latest
.../Library/pnpm/store/v3/tmp/dlx-84374  | Progress: resolved 1, reused 0, downlo.../Library/pnpm/store/v3/tmp/dlx-84374  | Progress: resolved 20, reused 15, down.../Library/pnpm/store/v3/tmp/dlx-84374  |  +57 ++++++
.../Library/pnpm/store/v3/tmp/dlx-84374  | Progress: resolved 20, reused 15, down.../Library/pnpm/store/v3/tmp/dlx-84374  | Progress: resolved 57, reused 57, down.../Library/pnpm/store/v3/tmp/dlx-84374  | Progress: resolved 57, reused 57, downloaded 0, added 57, done

╭─────╮  Houston:
│ ◠ ◡ ◠  Awaiting further instructions.
╰─────╯

 astro   v3.0.12 Launch sequence initiated.

   dir   Where should we create your new project?
         ./apps/web

  tmpl   How would you like to start your new project?
         Include sample files
      ✔  Template copied

  deps   Install dependencies?
         Yes
      ✔  Dependencies installed

    ts   Do you plan to write TypeScript?
         Yes

   use   How strict should TypeScript be?
         Strict
      ✔  TypeScript customized

   git   Initialize a new git repository?
         No
      ◼  Sounds good! You can always run git init manually.

  next   Liftoff confirmed. Explore your project!

         Enter your project directory using cd ./apps/web 
         Run pnpm dev to start the dev server. CTRL+C to stop.
         Add frameworks like react or tailwind using astro add.

         Stuck? Join us at https://astro.build/chat

╭─────╮  Houston:
│ ◠ ◡ ◠  Good luck out there, astronaut! 🚀
╰─────╯
➜  astro-integrations-turborepo-pnpm git:(main) ✗ cd apps/web    
➜  web git:(main) ✗ pnpm astro add react

> [email protected] astro /Users/atanaskanchev/Downloads/astro-integrations-turborepo-pnpm/apps/web
> astro "add" "react"

✔ Resolving packages...

  Astro will run the following command:
  If you skip this step, you can always run it yourself later

 ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮
 │ pnpm add @astrojs/react @types/react-dom@^18.0.6 @types/react@^18.0.21 react-dom@^18.0.0 react@^18.0.0  │
 ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯

✔ Continue? … yes
✖ Installing dependencies...

  ERR_PNPM_INCLUDED_DEPS_CONFLICT  modules directory (at "/Users/atanaskanchev/Downloads/astro-integrations-turborepo-pnpm") was installed with optionalDependencies, dependencies, devDependencies. Current install wants optionalDependencies, dependencies. 

 error   Astro could not update your astro.config.js file safely.
  Reason: Unable to install dependencies
  
  You will need to add these integration(s) manually.
  Documentation: https://docs.astro.build/en/guides/integrations-guide/
  File:
    /Users/atanaskanchev/Downloads/astro-integrations-turborepo-pnpm/node_modules/.pnpm/[email protected]/node_modules/astro/dist/cli/add/index.js:169:31
  Code:
    168 |     case 3 /* failure */: {
    > 169 |       throw createPrettyError(new Error(`Unable to install dependencies`));
          |                               ^
      170 |     }
      171 |   }
      172 |   const rawConfigPath = await resolveConfigPath({
  Stacktrace:
Error: Astro could not update your astro.config.js file safely.
Reason: Unable to install dependencies

You will need to add these integration(s) manually.
Documentation: https://docs.astro.build/en/guides/integrations-guide/
    at add (file:///Users/atanaskanchev/Downloads/astro-integrations-turborepo-pnpm/node_modules/.pnpm/[email protected]/node_modules/astro/dist/cli/add/index.js:169:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runCommand (file:///Users/atanaskanchev/Downloads/astro-integrations-turborepo-pnpm/node_modules/.pnpm/[email protected]/node_modules/astro/dist/cli/index.js:102:7)
    at async cli (file:///Users/atanaskanchev/Downloads/astro-integrations-turborepo-pnpm/node_modules/.pnpm/[email protected]/node_modules/astro/dist/cli/index.js:144:5)

 ELIFECYCLE  Command failed with exit code 1.

@Princesseuh Princesseuh added - P3: minor bug An edge case that only affects very specific usage (priority) feat: add Related to `astro add` CLI command (scope) and removed needs response Issue needs response from OP labels Sep 14, 2023
@millette
Copy link
Contributor

I use verdaccio (local npm registry) and pnpm and it fails for me too.

pnpm astro add tailwind

> [email protected] astro /home/millette/travail/waglo
> astro "add" "tailwind"

✖ @astrojs/tailwind doesn't appear to be an integration or an adapter. 
Find our official integrations at https://astro.build/integrations
ELIFECYCLE  Command failed with exit code 1.

Same error for all integrations I try adding.

@michelemadeddu
Copy link

Hi, same ERR_PNPM_INCLUDED_DEPS_CONFLICT  error installing react integration through "pnpm astro add react", though I'm not using turborepo in my monorepo.

@florian-lefebvre
Copy link
Member

Facing same issue on a simple pnpm monorepo

@millette
Copy link
Contributor

millette commented Oct 5, 2023

Actually, my problems appears whether I use pnpm or npm and boils down to registry auth. In my case, I had configured my verdaccio proxy registry to use username/password on localhost but that info isn't passed automatically to npm or pnpm.

@dr7v3
Copy link

dr7v3 commented Nov 16, 2023

I've had this issue as well for the last couple of months. I've recently updated node (v21.2.0), pnpm (8.10.5), and running the lastest version of astro (3.5.4). Did not have an issue this time around, I also added the latest @turbo/gen as a devDependency to the package.json of turborepo, something like this:

"scripts": {
"build": "turbo run build",
"dev": "turbo run dev"
},
"devDependencies": {
"@turbo/gen": "^1.10.16",
"turbo": "latest"
},
"packageManager": "[email protected]",
"name": "turbo"

Hope this helps!

@bluwy
Copy link
Member

bluwy commented Jan 3, 2024

I updated the repro to Astro 4 and it seems to work now. Going to close this as fixed

@bluwy bluwy closed this as completed Jan 3, 2024
@millette
Copy link
Contributor

millette commented Jan 3, 2024

It works for me too with verdaccio and pnpm, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: add Related to `astro add` CLI command (scope)
Projects
None yet
Development

No branches or pull requests

8 participants