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

create-astro is incompatible with Yarn Berry #5637

Closed
1 task
ansidev opened this issue Dec 19, 2022 · 2 comments · Fixed by #8028
Closed
1 task

create-astro is incompatible with Yarn Berry #5637

ansidev opened this issue Dec 19, 2022 · 2 comments · Fixed by #8028
Labels
- P2: has workaround Bug, but has workaround (priority)

Comments

@ansidev
Copy link
Contributor

ansidev commented Dec 19, 2022

What version of astro are you using?

1.7.1

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

None

What package manager are you using?

yarn berry

What operating system are you using?

Mac

Describe the Bug

  1. Run yarn create astro@latest -- --template with-tailwindcss (yarn -v = 3.3.0)

Problem:

  • Dependency module was not installed.

Workaround:

  • cd into project root folder.
  • Create an empty yarn.lock.
  • Run yarn install.
  1. Run yarn dev and go to http://localhost:3000/markdown-page.

Problem:

  • Page displayed an error.

Workaround:

  • Add this line: nodeLinker: node-modules into .yarnrc.yml.
  • Run yarn install.
  • Run yarn dev.

Link to Minimal Reproducible Example

N/A

Participation

  • I am willing to submit a pull request for this issue.
@bluwy
Copy link
Member

bluwy commented Dec 19, 2022

This works for me.

  • Create an empty yarn.lock.

Are you getting this error if not?

Usage Error: The nearest package directory (/Users/bjorn/Work/repros/astro-yarn-berry/test-yarn) doesn't seem to be part of the project declared in /Users/bjorn/Work/repros/astro-yarn-berry.

- If /Users/bjorn/Work/repros/astro-yarn-berry isn't intended to be a project, remove any yarn.lock and/or package.json file there.
- If /Users/bjorn/Work/repros/astro-yarn-berry is intended to be a project, it might be that you forgot to list test-yarn in its workspace configuration.
- Finally, if /Users/bjorn/Work/repros/astro-yarn-berry is fine and you intend test-yarn to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.

I find create-astro seem to swallow it too when auto-installing it so might be good to fix this.

@bluwy bluwy added the - P2: nice to have Not breaking anything but nice to have (priority) label Dec 19, 2022
@levic
Copy link

levic commented Jan 29, 2023

Can confirm that creating an empty yarn.lock fixes this, however the nodeLinker: node-modules step is no longer required thanks to #4842

$ yarn --version
1.22.19
$ yarn set version berry
$ yarn create astro@latest

astro   v2.0.2 ...

# use defaults for everything except project name:
# - project name: myproject
# - a few best practices
# - install yarn dependencies: yes
# - initialize a new git repository: yes
# - typescript: strict

$ cd myproject
$ yarn dev

Usage Error: The nearest package directory ... doesn't seem to be part of the project declared in ...

Workaround:

$ touch yarn.lock

This now works as expected:

$ yarn install
$ yarn dev

@Princesseuh Princesseuh added - P2: has workaround Bug, but has workaround (priority) and removed - P2: nice to have Not breaking anything but nice to have (priority) labels Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: has workaround Bug, but has workaround (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants