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

New project without Typescript does not start #12204

Closed
1 task
wooly opened this issue Oct 12, 2024 · 3 comments · Fixed by #12273
Closed
1 task

New project without Typescript does not start #12204

wooly opened this issue Oct 12, 2024 · 3 comments · Fixed by #12273
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@wooly
Copy link

wooly commented Oct 12, 2024

Astro Info

❯ yarn astro info
yarn run v1.22.19
warning package.json: No license field
warning ../package.json: No license field
$ astro info
Cannot find package 'typescript' imported from /Users/steve/version-control/colloquial/marketing/node_modules/zod-to-ts/dist/index.js
  Stack trace:
    at packageResolve (node:internal/modules/esm/resolve:854:9)
    at defaultResolve (node:internal/modules/esm/resolve:1169:11)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:510:25)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:96:40)

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

No response

Describe the Bug

Bootstrapping an Astro project with the yarn create astro command and selecting 'No' to Typescript causes an error and the dev server fails to start.

❯ yarn create astro
yarn create v1.22.19
warning package.json: No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...

success Installed "[email protected]" with binaries:
      - create-astro
[##########################] 26/26
 astro   Launch sequence initiated.

   dir   Where should we create your new project?
         .

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

    ts   Do you plan to write TypeScript?
         No
      ◼  No worries! TypeScript is supported in Astro by default,
         but you are free to continue writing JavaScript instead.

  deps   Install dependencies?
         Yes
      ◼  Nice! Git has already been initialized

      ✔  Project initialized!
         ■ Template copied
         ■ Dependencies installed

  next   Liftoff confirmed. Explore your project!
         Run yarn 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! 🚀
╰──🍫─╯
✨  Done in 52.63s.
❯ yarn dev
yarn run v1.22.19
warning package.json: No license field
warning ../package.json: No license field
$ astro dev
Cannot find package 'typescript' imported from /Users/steve/version-control/colloquial/marketing/node_modules/zod-to-ts/dist/index.js
  Stack trace:
    at packageResolve (node:internal/modules/esm/resolve:854:9)
    at defaultResolve (node:internal/modules/esm/resolve:1169:11)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:510:25)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:96:40)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What's the expected result?

The server starts normally.

Link to Minimal Reproducible Example

Not possible.

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 Oct 12, 2024
@bluwy
Copy link
Member

bluwy commented Oct 12, 2024

We may have to investigate this again as I remember @Princesseuh brought up that zod-to-ts has a peer dependency on typescript, so technically every Astro project needs to have typescript installed.

It's not a problem for npm or pnpm I believe since they're able to auto install that for you, but I'm not sure about yarn, which the repro shows.

@bluwy bluwy added - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs triage Issue needs to be triaged labels Oct 12, 2024
@ascorbic
Copy link
Contributor

Yes, we originally decided it was OK to add it, because we already had a transitive peer dep via tsconfck. However it seems that peerdep is optional, so I think perhaps we do need to handle this case.

@ascorbic
Copy link
Contributor

That said, Astro 5 will always install TypeScript, so maybe this is moot.

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)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants