`yarn create next-app` fails when directory is a workspace
See original GitHub issueWhat 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
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@MISSOURI10101 Yep, removing the version number seems to be causing the issue. Also, the
version
field was present inv12.0.1
but was removed inv12.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 foryarn@v1
.I believe
version
should be placed back into thepackageJson
object with a0.0.0
(or0.1.0
, asnpx
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 with0.1.0
as theversion
in thepackage.json
upon app creation.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.