question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`yarn create next-app` fails when directory is a workspace

See original GitHub issue

What version of Next.js are you using?

12.0.7

What version of Node.js are you using?

16.13.1

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

next export

Describe the Bug

With the following project structure:

.
├── node_modules
├── package.json
├── sites # this is a workspace
└── yarn.lock

And with the following package.json:

{
  "name": "workspace-test",
  "version": "1.0.0",
  "private": true,
  "license": "MIT",
  "workspaces": [
    "sites/*"
  ]
}

Running this command fails:

yarn create next-app sites/hello-world

With this following output:

yarn create v1.22.17
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Installed "create-next-app@12.0.7" with binaries:
      - create-next-app
[##] 2/2Creating a new Next.js app in /Users/karbi/dev/workspace-test/sites/hello-world.

Using yarn.

Installing dependencies:
- react
- react-dom
- next

yarn add v1.22.17
warning Missing version in workspace at "/Users/karbi/dev/workspace-test/sites/asd", ignoring.
warning Missing version in workspace at "/Users/karbi/dev/workspace-test/sites/hello-world", ignoring.
error An unexpected error occurred: "Cannot read properties of undefined (reading 'manifest')".
info If you think this is a bug, please open a bug report with the information provided in "/Users/karbi/dev/workspace-test/sites/hello-world/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Expected Behavior

I would expect that following command would produce a successful boilerplate without error:

yarn create next-app sites/hello-world

Additionally, running the following command works successfully when not targeting a workspace:

yarn create next-app hello-world

To note, using npx works successfully:

npx create-next-app sites/hello-world

To Reproduce

Clone this repository and run the following command in the project root:

yarn create next-app sites/hello-world
Screen Shot 2021-12-21 at 1 20 09 PM

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

2reactions
karbicacommented, Dec 24, 2021

@MISSOURI10101 Yep, removing the version number seems to be causing the issue. Also, the version field was present in v12.0.1 but was removed in v12.0.2.

Here is a related issue to workspaces not having their dependencies installed if their version is omitted. It was fixed in yarn@v2 but still broken for yarn@v1.

I believe version should be placed back into the packageJson object with a 0.0.0 (or 0.1.0, as npx does) value for backwards compatibility. And if the developer wants to omit it, then they are free to do so.

Also to note, I now see the reason why npx works is because it defaults with 0.1.0 as the version in the package.json upon app creation.

0reactions
github-actions[bot]commented, Mar 9, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solution NEXT.js: yarn create next-app FAILED
Running yarn create next-app will fail with 'C:\Users\John' is not recognized as an internal or external command. If setting cache folder for yarn...
Read more >
npx create-next-app will only ceate a package.json file and ...
I have been trying to create a new nextjs app for a project but I keep ... react-dom - next Usage Error: The...
Read more >
Create Next App | Next.js
Create Next.js apps in one command with create-next-app. ... npx create-next-app@latest # or yarn create next-app # or pnpm create next-app.
Read more >
Turborepo Tutorial | Part 1 - Typescript, Eslint, Tailwind, Husky ...
We will focus on creating a shared base typescript config, ... to use our different workspace packages within our different applications.
Read more >
Contributing - Frontend Application Bundles
This test is fairly slow, so repeated runs will try to reuse the tmp directory. For example, the first step in the yarn...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found