create-t3-app icon indicating copy to clipboard operation
create-t3-app copied to clipboard

bug: can't install tagged versions with `yarn`

Open marlalain opened this issue 1 year ago • 38 comments

Provide environment information

6.0.0-next.2af4bc9

Describe the bug

Can't install the project with Yarn version 2.

To reproduce

npx create-t3-app@next something
cd something
yarn install
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 6s 756ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ wrappy@npm:1.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yallist@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yocto-queue@npm:0.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ zod@npm:3.19.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ typescript@npm:4.7.4 can't be found in the cache and will be fetched from the remote registry
➤ YN0066: │ typescript@patch:typescript@npm%3A4.7.4#builtin<compat/typescript>::version=4.7.4&hash=8133ad: Cannot apply hunk #2 (set enableInlineHunks for details)
➤ YN0000: └ Completed in 32s 30ms
➤ YN0000: Failed with errors in 38s 791ms```

### Additional information

yarn --version
2.4.3

node --version
v16.17.0

npm --version
8.15.0

marlalain avatar Sep 16 '22 08:09 marlalain

npm, pnpm and yarn@1 work. Going to create a PR warning the user (if they are using yarn@2 or yarn@3) that installation may fail

marlalain avatar Sep 16 '22 08:09 marlalain

we already have a check for yarn 3. maybe you can just expand it to also check for yarn 2?

c-ehrlich avatar Sep 16 '22 08:09 c-ehrlich

I did this, but I don't know how I'm supposed to test this https://github.com/minsk-dev/create-t3-app/commit/965cd968375872ca406b9e4e77add7afbb708722 @c-ehrlich

marlalain avatar Sep 16 '22 09:09 marlalain

When I built the yarn 3 check I did manual testing, used different VMs where I had different package managers installed (there's probably a better way but not sure what it is)

c-ehrlich avatar Sep 16 '22 10:09 c-ehrlich

npx create-t3-app@next something
cd something
yarn install

this seems weird. why would you npx then yarn install?

juliusmarminge avatar Sep 16 '22 14:09 juliusmarminge

Does it matter? The generated project is supposed to be the same. Also, looks like yarn@2 can't run the CLI.

➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 4s 950ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ sort-package-json@npm:1.57.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ tinycolor2@npm:1.4.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ tinygradient@npm:1.1.5 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ type-fest@npm:1.4.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ wrap-ansi@npm:8.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 1s 276ms
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: Done in 6s 328ms

/Users/anon/.yarn/berry/cache/create-t3-app-npm-6.0.0-next.2af4bc9-8a4bcf0cd8-7.zip/node_modules/create-t3-app/dist/index.js:2
import he from"path";import ye from"fs-extra";import b from"path";import J from"fs-extra";import D from"path";import{fileURLToPath as Oe}from"url";var Ne=Oe(import.meta.url),Me=D.dirname(Ne),c=D.join(Me,"../"),$=`   ___ ___ ___   __ _____ ___   _____ ____    __   ___ ___
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:360:18)
    at wrapSafe (node:internal/modules/cjs/loader:1055:15)
    at Module._compile (node:internal/modules/cjs/loader:1090:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.external_module_.Module._load (/private/var/folders/mc/f08wsz9x4ns8fvx3b3bb3x740000gp/T/xfs-5673fae3/dlx-46995/.pnp.js:6021:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47```

marlalain avatar Sep 16 '22 14:09 marlalain

well the problem with yarn 3 is that you can't scaffold the project. you should test running the cli with it. if you can't install dependencies with yarn install I can't see how it's CT3A's fault without seeing the actual error message 🤔

Also, looks like yarn@2 can't run the CLI.

Yes this is more interesting and should be tagged.

juliusmarminge avatar Sep 16 '22 14:09 juliusmarminge

SyntaxError: Cannot use import statement outside a module

Wow yarn is weird...

juliusmarminge avatar Sep 16 '22 14:09 juliusmarminge

SyntaxError: Cannot use import statement outside a module

Wow yarn is weird...

Probably because of the way we are making the bundle right now. https://github.com/t3-oss/create-t3-app/blob/main/package.json#L9

marlalain avatar Sep 16 '22 14:09 marlalain

Update: Looks like you can't use yarn@1 now.

yarn create t3-app@next
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-t3-app
/bin/sh: /Users/anon/.yarn/bin/create-t3-app@next: No such file or directory
error Command failed.
Exit code: 127
Command: /Users/anon/.yarn/bin/create-t3-app@next
Arguments: asdf
Directory: /private/tmp
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

marlalain avatar Sep 19 '22 10:09 marlalain

Update: Looks like you can't use yarn@1 now.


yarn create t3-app@next


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-t3-app

/bin/sh: /Users/anon/.yarn/bin/create-t3-app@next: No such file or directory

error Command failed.

Exit code: 127

Command: /Users/anon/.yarn/bin/create-t3-app@next

Arguments: asdf

Directory: /private/tmp

Output:



info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

I don't think yarn ever played nice with version tags?

juliusmarminge avatar Sep 19 '22 11:09 juliusmarminge

I believe this was working before. I don't think any major version of yarn works now

marlalain avatar Sep 19 '22 11:09 marlalain

I believe this was working before. I don't think any major version of yarn works now

Not sure what the difference is in terms of the cli, does @beta tag work? Maybe yarns binaries aren’t updated yet?

juliusmarminge avatar Sep 19 '22 11:09 juliusmarminge

I believe this was working before. I don't think any major version of yarn works now

Not sure what the difference is in terms of the cli, does @beta tag work? Maybe yarns binaries aren’t updated yet?

Also doesn't work. Now, I'm not sure if this was working before... 🤔

marlalain avatar Sep 19 '22 11:09 marlalain

I believe this was working before. I don't think any major version of yarn works now

Not sure what the difference is in terms of the cli, does @beta tag work? Maybe yarns binaries aren’t updated yet?

Also doesn't work. Now, I'm not sure if this was working before... 🤔

I think when I've tested beta and next with yarn it doesn't like the version tag at the end for some reason.

Just use pnpm or npm I guess

juliusmarminge avatar Sep 19 '22 11:09 juliusmarminge

@c-ehrlich A PR warning against yarn? What do you think? I could do it

marlalain avatar Sep 19 '22 11:09 marlalain

@c-ehrlich A PR warning against yarn? What do you think? I could do it

I don't think you even get to that point when you try the tags? Like even a log at line1 wouldn't be printed I'm pretty sure.

It fails to locate the binary is what I think is happening?

juliusmarminge avatar Sep 19 '22 11:09 juliusmarminge

It looks like it's trying to run create-t3-app@next. With the @next thing

marlalain avatar Sep 19 '22 11:09 marlalain

It looks like it's trying to run create-t3-app@next. With the @next thing

Is there another way to run tagged scripts (like yarn create t3-app --tag next or smth)?Some other cli that we can test on? I can't see how this can be caused by us?

juliusmarminge avatar Sep 19 '22 11:09 juliusmarminge

Doesn't look like it

yarn create --help
warning package.json: No license field

  Usage: yarn [command] [flags]

  Creates new projects from any create-* starter kits.

  Options:

    -v, --version                       output the version number
    --no-default-rc                     prevent Yarn from automatically detecting yarnrc and npmrc files
    --use-yarnrc <path>                 specifies a yarnrc file that Yarn should use (.yarnrc only, not .npmrc) (default: )
    --verbose                           output verbose messages on internal operations
    --offline                           trigger an error if any required dependencies are not available in local cache
    --prefer-offline                    use network only if dependencies are not available in local cache
    --enable-pnp, --pnp                 enable the Plug'n'Play installation
    --disable-pnp                       disable the Plug'n'Play installation
    --strict-semver
    --json                              format Yarn log messages as lines of JSON (see jsonlines.org)
    --ignore-scripts                    don't run lifecycle scripts
    --har                               save HAR output of network traffic
    --ignore-platform                   ignore platform checks
    --ignore-engines                    ignore engines check
    --ignore-optional                   ignore optional dependencies
    --force                             install and build packages even if they were built before, overwrite lockfile
    --skip-integrity-check              run install without checking if node_modules is installed
    --check-files                       install will verify file tree of packages for consistency
    --no-bin-links                      don't generate bin links when setting up packages
    --flat                              only allow one version of a package
    --prod, --production [prod]
    --no-lockfile                       don't read or generate a lockfile
    --pure-lockfile                     don't generate a lockfile
    --frozen-lockfile                   don't generate a lockfile and fail if an update is needed
    --update-checksums                  update package checksums from current repository
    --link-duplicates                   create hardlinks to the repeated modules in node_modules
    --link-folder <path>                specify a custom folder to store global links
    --global-folder <path>              specify a custom folder to store global packages
    --modules-folder <path>             rather than installing modules into the node_modules folder relative to the cwd, output them here
    --preferred-cache-folder <path>     specify a custom folder to store the yarn cache if possible
    --cache-folder <path>               specify a custom folder that must be used to store the yarn cache
    --mutex <type>[:specifier]          use a mutex to ensure only one yarn instance is executing
    --emoji [bool]                      enable emoji in output (default: true)
    -s, --silent                        skip Yarn console logs, other types of logs (script output) will be printed
    --cwd <cwd>                         working directory to use (default: /private/tmp)
    --proxy <host>
    --https-proxy <host>
    --registry <url>                    override configuration registry
    --no-progress                       disable progress bar
    --network-concurrency <number>      maximum number of concurrent network requests
    --network-timeout <milliseconds>    TCP timeout for network requests
    --non-interactive                   do not show interactive prompts
    --scripts-prepend-node-path [bool]  prepend the node executable dir to the PATH in scripts
    --no-node-version-check             do not warn when using a potentially unsupported Node version
    --focus                             Focus on a single workspace by installing remote copies of its sibling workspaces.
    --otp <otpcode>                     one-time password for two factor authentication
    -h, --help                          output usage information
  Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

marlalain avatar Sep 19 '22 11:09 marlalain

Can you do yarn dlx create-t3-app@next?

juliusmarminge avatar Sep 19 '22 11:09 juliusmarminge

@juliusmarminge Command not found

marlalain avatar Sep 19 '22 11:09 marlalain

yarn create is made for this case. I don't know why they don't handle tags. Will take a look at their issues and see if I can find something

marlalain avatar Sep 19 '22 11:09 marlalain

yarn create is made for this case. I don't know why they don't handle tags. Will take a look at their issues and see if I can find something

As you might have guessed i wasnt at my PC, nor do I use yarn xD

If you find a fix feel free to PR but I don't have time to personally look into it. Maybe some yarn users are interested?

juliusmarminge avatar Sep 19 '22 15:09 juliusmarminge

if its not possible to use version tags with yarn 1 then i don't see a reason to put a warning.

personally even when i use yarn as my package manager, i scaffold with npx

c-ehrlich avatar Sep 19 '22 20:09 c-ehrlich

Looks like you can specify yarn versions on the package.json: https://github.com/calcom/cal.com/blob/main/package.json#L97.


if its not possible to use version tags with yarn 1 then i don't see a reason to put a warning.

personally even when i use yarn as my package manager, i scaffold with npx

I think a warning on the project's README should be enough?

marlalain avatar Sep 20 '22 08:09 marlalain

Looks like you can specify yarn versions on the package.json: https://github.com/calcom/cal.com/blob/main/package.json#L97.

if its not possible to use version tags with yarn 1 then i don't see a reason to put a warning. personally even when i use yarn as my package manager, i scaffold with npx

I think a warning on the project's README should be enough?

We can do all of this i guess:

  • restrict yarn version in package.json
  • update isntallation guide (README and Docs) and put a note that if you're using yarn, scaffold with npm and choose noInstall and install deps on your own 🤔

juliusmarminge avatar Sep 20 '22 09:09 juliusmarminge

I can do that. Will open a PR later

marlalain avatar Sep 20 '22 09:09 marlalain

I can do that. Will open a PR later

Are you still free to make a PR?

nexxeln avatar Sep 28 '22 13:09 nexxeln

I can do that. Will open a PR later

Are you still free to make a PR?

I don't have the time to test this right now. Writing is simple, but I would have to mess with my packages to test this

marlalain avatar Sep 28 '22 16:09 marlalain