berry icon indicating copy to clipboard operation
berry copied to clipboard

(🐞) Error message when running `yarn init -2` in a project subdirectory contains incorrect details

Open KotlinIsland opened this issue 2 years ago β€’ 4 comments

Self-service

  • [X] I'd be willing to implement a fix

Describe the bug

Run yarn init -2 in a project subdirectory and the contents of the error don't match the command passed.

To reproduce

πŸ‘‰ yarn init -2
Usage Error: Cannot use the --install flag from within a project subdirectory

$ yarn init [-p,--private] [-w,--workspace] [-i,--install] [-n,--name #0]

This states that the --install flag is being used, which it's not.

Environment

πŸ‘‰ yarn dlx -q envinfo --preset jest
➀ YN0027: envinfo@unknown can't be resolved to a satisfying range
➀ YN0001: RequestError: tunneling socket could not be established, statusCode=407
    at ClientRequest.<anonymous> (C:\Users\AMONGUS\AppData\Local\node\corepack\yarn\3.2.4\yarn.js:258:14340)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:525:35)
    at o.emit (C:\Users\AMONGUS\AppData\Local\node\corepack\yarn\3.2.4\yarn.js:253:90235)
    at ClientRequest.c (C:\Users\AMONGUS\AppData\Local\node\corepack\yarn\3.2.4\yarn.js:258:33205)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:513:28)
    at Socket.socketOnData (node:_http_client:570:11)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at ClientRequest.c (C:\Users\AMONGUS\AppData\Local\node\corepack\yarn\3.2.4\yarn.js:258:33094)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:513:28)
    at Socket.socketOnData (node:_http_client:570:11)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

➀ Errors happened when preparing the environment required to run this command.

Additional context

btw, I'm using yarn 4.0.0-rc.32

KotlinIsland avatar Dec 08 '22 07:12 KotlinIsland

In a project subdirectory (I'm not, I'm in ~/projects/asdfsadfg)

You probably have a bogus yarn.lock in ~ or ~/projects.

arcanis avatar Dec 18 '22 10:12 arcanis

@arcanis True, I'll update the issue to focus on these details

KotlinIsland avatar Dec 19 '22 06:12 KotlinIsland

This message is also produced if there's a bogus package.json in a parent directory.

sethwklein avatar Aug 03 '23 05:08 sethwklein

Getting this when trying to initialize a workspace in a monorepo in 4.3.1.

  • There is a yarn.lock and package.json in monorepo root
  • There’s no package.json in immediate ancestor
  • Regardless of the above, the error message clearly indicates there’s a bugβ€”the flag mentioned (--install) was never passed to init

strogonoff avatar Jul 31 '24 06:07 strogonoff