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

Remove outdated yarn.lock in CodeSandbox repros #57895

Closed
wants to merge 10 commits into from
Closed

Remove outdated yarn.lock in CodeSandbox repros #57895

wants to merge 10 commits into from

Conversation

karlhorky
Copy link
Contributor

@karlhorky karlhorky commented Nov 1, 2023

Closes #57896
Closes #63038

What?

Remove the outdated yarn.lock file that CodeSandbox saves between sandbox starts

Why?

As confirmed with @CompuIves, CodeSandbox caches the yarn.lock file generated after the first start + yarn install of a GitHub template (Yarn v1) - this saves old versions of Next.js (not the latest canary) in the lockfile and causes old versions of Next.js to be installed when users click on the CodeSandbox Reproduction link during issue creation.

This leads to the current breakage, where Next.js actually cannot even start in the reproduction sandbox:

  1. Start creating a new GitHub issue on the vercel/next GitHub repo
  2. Open the CodeSandbox reproduction link linked in the Link to the code that reproduces this issue section
  3. Observe the error message below in the dev task started below (experimental.appDir: true was required in the 13.0.8-canary.0 version of Next.js in the cached yarn.lock file, but the next.config.js file no longer includes this config)
$ yarn dev
yarn run v1.22.19
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
Error: > The `app` directory is experimental. To enable, add `appDir: true` to your `next.config.js` configuration under `experimental`. See https://nextjs.org/docs/messages/experimental-app-dir-config
    at Object.findPagesDir (/project/sandbox/node_modules/next/dist/lib/find-pages-dir.js:80:19)
    at new DevServer (/project/sandbox/node_modules/next/dist/server/dev/next-dev-server.js:110:59)
    at NextServer.createServer (/project/sandbox/node_modules/next/dist/server/next.js:140:20)
    at /project/sandbox/node_modules/next/dist/server/next.js:155:42
    at async NextServer.prepare (/project/sandbox/node_modules/next/dist/server/next.js:130:24)
    at async /project/sandbox/node_modules/next/dist/cli/next-dev.js:344:17
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Sandbox demo: https://codesandbox.io/p/sandbox/quirky-pascal-n32xk2?file=%2Fnext.config.js%3A5%2C1

Screenshot 2023-11-01 at 16 09 59

How?

Remove (using rm) the outdated yarn.lock file

Caveats

This uses CodeSandbox-specific config, which is potentially unwanted, eg. this comment by @balazsorban44

Alternatives considered

cc @balazsorban44 @CompuIves

@karlhorky karlhorky requested review from a team as code owners November 1, 2023 15:18
@karlhorky karlhorky requested review from timeyoutakeit and leerob and removed request for a team November 1, 2023 15:18
@ijjk ijjk added the examples Issue/PR related to examples label Nov 1, 2023
@ijjk
Copy link
Member

ijjk commented Nov 1, 2023

Allow CI Workflow Run

  • approve CI run for commit: 5e5cff0

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@ijjk
Copy link
Member

ijjk commented Nov 1, 2023

Allow CI Workflow Run

  • approve CI run for commit: 9eeac6d

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@karlhorky karlhorky changed the title Remove outdated yarn.lock file Use pnpm for CodeSandbox repros Mar 8, 2024
@karlhorky karlhorky changed the title Use pnpm for CodeSandbox repros Remove outdated yarn.lock in CodeSandbox repros Mar 8, 2024
@styfle styfle closed this in #63038 Mar 8, 2024
styfle pushed a commit that referenced this pull request Mar 8, 2024
Closes #57895
Closes #57896

### What?

Switch Yarn v1 to pnpm for reproduction repos, avoiding the CodeSandbox
Yarn v1 `yarn.lock` caching problem described below

### Why?

As confirmed with @CompuIves, CodeSandbox caches the `yarn.lock` file
generated after the first start + `yarn install` of a GitHub template
(Yarn v1) - this saves old versions of Next.js (not the latest canary)
in the lockfile and causes old versions of Next.js to be installed when
users click on the CodeSandbox Reproduction link during issue creation.

This leads to the current breakage, where Next.js actually cannot even
start in the reproduction sandbox:

1. Start creating a new GitHub issue on the `vercel/next` GitHub repo
2. Open [the CodeSandbox reproduction
link](https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template)
linked in the **Link to the code that reproduces this issue** section
3. Observe the error message below in the `dev` task started below
(`experimental.appDir: true` was required in the `13.0.8-canary.0`
version of Next.js in the cached `yarn.lock` file, but the
`next.config.js` file no longer includes this config)

```bash
$ yarn dev
yarn run v1.22.19
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
Error: > The `app` directory is experimental. To enable, add `appDir: true` to your `next.config.js` configuration under `experimental`. See https://nextjs.org/docs/messages/experimental-app-dir-config
    at Object.findPagesDir (/project/sandbox/node_modules/next/dist/lib/find-pages-dir.js:80:19)
    at new DevServer (/project/sandbox/node_modules/next/dist/server/dev/next-dev-server.js:110:59)
    at NextServer.createServer (/project/sandbox/node_modules/next/dist/server/next.js:140:20)
    at /project/sandbox/node_modules/next/dist/server/next.js:155:42
    at async NextServer.prepare (/project/sandbox/node_modules/next/dist/server/next.js:130:24)
    at async /project/sandbox/node_modules/next/dist/cli/next-dev.js:344:17
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```

Sandbox demo:
https://codesandbox.io/p/sandbox/quirky-pascal-n32xk2?file=%2Fnext.config.js%3A5%2C1

![Screenshot 2023-11-01 at 16 09
59](https://github.com/vercel/next.js/assets/1935696/b8287a2e-86b4-4c08-afca-bc9219b6d411)

### How?

Switch to pnpm installation commands instead of Yarn v1

### Caveats

This uses CodeSandbox-specific config

### Alternatives considered

- Delete the outdated yarn.lock file on setup of the sandbox, PR open
here: #57895
- Commit an empty `yarn.lock` file to block caching of this file, PR
open here: #57896

cc @samcx @CompuIves
@karlhorky karlhorky deleted the patch-4 branch March 8, 2024 15:40
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants