yarn –pnp / binary not found (here: nodemon) / unplugued ?

Do you want to request a feature or report a bug?
A bug

What is the current behavior?
When I install nodemon with yarn pnp, the binary is not found. I suspect this is because nodemon is unplugued because eslint (which is not unplugued) works!

➜ ls -1 .pnp/unplugged

If the current behavior is a bug, please provide the steps to reproduce.

  • yarn init -y
  • yarn --pnp add --dev nodemon
  • yarn nodemon
➜  yarn nodemon
yarn run v1.13.0
error Command "nodemon" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What is the expected behavior?
nodemon should be executed.

Please mention your node.js, yarn and operating system version.

  • node: 11.6.0
  • yarn: 1.13.0
  • os: macOS Mojave

edit: I just tried with nightly build and this is still KO 😉 (v1.14.0-20190107.1111)

Author: Fantashit

2 thoughts on “yarn –pnp / binary not found (here: nodemon) / unplugued ?

  1. Yep, Berry is the codename for the v2 (the repo is here).

    I’ll speak about pnp and think at riviera dev in May. Will you attempt @arcanis ?

    Oh nice! I won’t be there (I already have React Europe & JSConf EU planned the following weeks), but let me know if you have questions or want a slide review (preferably through our Discord channel, more suited than Github for this kind of things).

    Do you want me to close this issue?

    I think it makes sense to keep this one open, maybe it’ll give it a better visibility in the search bar 👍

  2. For anyone who ends up here from Google like I did, trying to figure out how to get things that used to be in node_modules/.bin to work now that you’ve switched to yarn v2 with pnp, here is what I’ve found so far after trying to figure it out for a while:

    If you are wondering why something like which nodemon doesn’t work any more, try yarn bin nodemon – be aware however the path that it returns is inside a zip file and doesn’t actually exist, so it’s probably useless for whatever you wanted to use it for.

    If you are trying to figure out why something like nodemon works when it’s run from a package.json scripts entry, but not when you run it from anywhere else, the docs say you should run it with yarn exec:

    $ yarn exec echo Hello World
    Usage Error: Couldn't find a script named "exec".

    I couldn’t figure out how that is supposed to work, but I did notice there is an exec plugin you can install with yarn plugin import @yarnpkg/plugin-exec. Installing it didn’t change anything though, so I’m not sure what problem the plugin is supposed to solve either..

    I originally ended up here trying to figure out how to get back to a state where I could run tsc and have that work. After several hours of reading docs and code it appears that I have two options (other than giving up on pnp entirely):

    • Only run things like tsc from within a package.json script (using yarn run build for example)
    • Run yarn workspace @my-project/my-repo tsc instead

    If you ended up here because something like Intellisense or linting in your editor broke when you switched to yarn AND your editor is VSCode, Emacs, or VIM (but only if you are using the coc.nvim plugin) AND the thing that broke is typescript, eslint, prettier, or stylelint, then see: https://yarnpkg.com/advanced/editor-sdks

    If you ended up here because you were trying to get the layout node option of direnv to work again, or you prefer being able to run tsc instead of yarn workspace @project/repo tsc, or you are trying to do anything else, then your only recourse is probably to give up on pnp entirely:
    Create a .yarnrc.yml file in the root of your project that contains: nodeLinker: node-modules

    As for me, I’m going back to v1 and will just have to deal with the fact that yarn add something fails frequently which was the reason I attempted to switch in the first place. There are a bunch of cool features in v2, but it doesn’t feel like it’s ready yet..

Comments are closed.