yeoman / yeoman-api

MIT License
1 stars 2 forks source link

Unable to run yo under "yarn dlx" due to ghost dependency issue #7

Closed zakuzakukakigori closed 1 month ago

zakuzakukakigori commented 1 month ago

Yarn (berry) reported that @yeoman/conflicter tried to access slash, but it isn't declared in its dependencies, as shown below:

yarn dlx -p yo -p generator-code -- yo code
➤ YN0000: · Yarn 4.3.1
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + generator-code@npm:1.11.1, yo@npm:5.0.0, @babel/code-frame@npm:7.24.7, @babel/helper-validator-identifier@npm:7.24.7, @babel/highlight@npm:7.24.7, @babel/runtime@npm:7.25.4, @inquirer/figures@npm:1.0.5, @isaacs/cliui@npm:8.0.2, and 715 more.
➤ YN0000: └ Completed in 12s 82ms
➤ YN0000: ┌ Post-resolution validation
➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ 723 packages were added to the project (+ 57.24 MiB).
➤ YN0000: └ Completed in 5s 619ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ spawn-sync@npm:1.0.15 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js@npm:3.38.1 must be built because it never has been before or the last one failed
➤ YN0007: │ yo@npm:5.0.0 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 4s 512ms
➤ YN0000: · Done with warnings in 22s 380ms

Error: @yeoman/conflicter tried to access slash, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: slash (via "slash/package.json")
Required by: @yeoman/conflicter@virtual:706c434fa0d273ff58c2c71c28af552aaa6a42026db7b1545266a45448b78a3bf21a36ca31f567270c1dc0b0158be52540288360d87407484ef76beb5750f618#npm:2.0.0 (via /data/data/com.termux/files/usr/tmp/xfs-7efc17ae/dlx-28030/.yarn/__virtual__/@yeoman-conflicter-virtual-a20303c9a5/0/cache/@yeoman-conflicter-npm-2.0.0-72ba9e773c-2197e5e98b.zip/node_modules/@yeoman/conflicter/dist/yo-resolve.js)

    at makeError (/data/data/com.termux/files/usr/tmp/xfs-7efc17ae/dlx-28030/.pnp.cjs:12873:34)
    at resolveToUnqualified (/data/data/com.termux/files/usr/tmp/xfs-7efc17ae/dlx-28030/.pnp.cjs:14521:21)
    at Object.resolveToUnqualified (/data/data/com.termux/files/usr/tmp/xfs-7efc17ae/dlx-28030/.pnp.cjs:14701:26)
    at resolve$1 (file:///data/data/com.termux/files/usr/tmp/xfs-7efc17ae/dlx-28030/.pnp.loader.mjs:2033:31)
    at nextResolve (node:internal/modules/esm/hooks:746:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:238:30)
    at handleMessage (node:internal/modules/esm/worker:199:24)
    at Immediate.checkForMessages (node:internal/modules/esm/worker:141:28)
    at process.processImmediate (node:internal/timers:483:21)
zakuzakukakigori commented 1 month ago

I can confirm that this specific error has been gone now. Thank you for quickly handling it and for publishing the fix, @mshima!

Output ``` yarn dlx -p yo -p generator-code -- yo code ``` ``` ➤ YN0000: · Yarn 4.3.1 ➤ YN0000: ┌ Resolution step ➤ YN0085: │ + generator-code@npm:1.11.1, yo@npm:5.0.0, @babel/code-frame@npm:7.24.7, @babel/helper-validator-identifier@npm:7.24.7, and 726 more. ➤ YN0000: └ Completed in 7s 27ms ➤ YN0000: ┌ Post-resolution validation ➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details. ➤ YN0000: └ Completed ➤ YN0000: ┌ Fetch step ➤ YN0013: │ 730 packages were added to the project (+ 57.22 MiB). ➤ YN0000: └ Completed in 0s 486ms ➤ YN0000: ┌ Link step ➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental ➤ YN0007: │ spawn-sync@npm:1.0.15 must be built because it never has been before or the last one failed ➤ YN0007: │ core-js@npm:3.38.1 must be built because it never has been before or the last one failed ➤ YN0007: │ yo@npm:5.0.0 must be built because it never has been before or the last one failed ➤ YN0000: └ Completed in 6s 81ms ➤ YN0000: · Done with warnings in 13s 820ms Error code You don't seem to have a generator with the name “generator-code” installed. But help is on the way: You can see available generators via npm search yeoman-generator or via http://yeoman.io/generators/. Install them with npm install generator-code. To see all your installed generators run yo --generators. Adding the --help option will also show subgenerators. If yo cannot find the generator, run yo doctor to troubleshoot your system. ```

It seems doesn't work due to Yarn PnP, which isn't yet supported, I guess. However, nodeLinker: node-modules option works:

yarn run yo code
(node:18386) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

     _-----_     ╭──────────────────────╮
    |       |    │   Welcome to the Visual  │
    |--(o)--|    │   Studio Code Extension  │
   `---------´   │        generator!        │
    ( _´U`_ )    ╰──────────────────────╯
    /___A___\   /
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

? What type of extension do you want to create? (Use arrow keys)
❯ New Extension (TypeScript)
  New Extension (JavaScript)
  New Color Theme
  New Language Support
  New Code Snippets
  New Keymap
  New Extension Pack
  New Language Pack (Localization)
  New Web Extension (TypeScript)
  New Notebook Renderer (TypeScript)