Closed fy0 closed 3 days ago
I haven't tried installing with yarn or on windows. Can you help us narrow this down by trying:
npx
, yarn run peggy
, and peggy
from a package.json scripts
entrynpx
and peggy
from a package.json scripts
entrypeggy
by itselfI don't have easy access to a Windows dev environment at the moment, so trying out some options will help a lot. Thanks!
What version of yarn are you using? When I try yarn global add peggy
on yarn@4.1.1, I get:
Usage Error: The 'yarn global' commands have been removed in 2.x - consider using 'yarn dlx' or a third-party plugin instead
What version of yarn are you using? When I try
yarn global add peggy
on yarn@4.1.1, I get:Usage Error: The 'yarn global' commands have been removed in 2.x - consider using 'yarn dlx' or a third-party plugin instead
Thx for reply, i use yarn 1.22. Now it's already not a problem for me.
I forked pigeon(one of golang's peg tool), then rewrote it to generate haxe code. Now i can use my pigeon version to generate js peg parser!
And seems yarn is not much better than npm since 2024(and 1.x is not maintained), maybe i should switch back to npm, or use pnpm to instead.
I am experiencing this issue, and I think it has nothing to do with yarn itself. I hadn't noticed it before because I normally use WSL, but when I had to test the system in the Windows host, I found this issue. Using an earlier version of peggy, such as 3.0.2 or 2.0.1 on Windows, or using the latest version on WSL (Ubuntu), both cases by running with yarn, does not cause any problems.
@lhsantos does it work with npx peggy
or npm install peggy -g
?
For npx peggy --version
with latest version installed locally, same error.
After installing peggy globally, npm install -g peggy
, then running in some non node directory, npx peggy --version
, same error.
npx peggy
won't look for the global one. Try just peggy -version
after npm install -g peggy
.
Note: I'm assuming that whatever yarn version you have isn't installing the same wrapper .bat file that npm does, and trying to see if that's actually true.
npx peggy
won't look for the global one. Try justpeggy -version
afternpm install -g peggy
.
Just peggy
does not find the command, and I did run npx peggy
in a non-node project directory, so the only one it could find would be the global one...
npx peggy
won't look for the global one. Try justpeggy -version
afternpm install -g peggy
.Just
peggy
does not find the command, and I did runnpx peggy
in a non-node project directory, so the only one it could find would be the global one...
Ah, sorry, actually peggy --version
does find the command, it just ends with the same error related to '-S.exe'
I tested the PR on my machine and it seems to work across git bash
, cmd
, and powershell
. Used these:
yarn global add
classic 1.22.22npm install --global
10.2.3npx
yarn dlx
(modern 4.5.0)But then it got a bit weird.
I tested the prior commands as well, and they only seemed to work w/ npm
under cmd
.
... but going back to double check the older versions, they all work for me on npm
now?
and I don't see the @IF EXIST "%~dp0\-S.exe"
mentioned in OP anymore, instead it is IF EXIST "%dp0%\node.exe"
This is the case with 3.0.2, 4.0.0, 4.0.3, and the PR.
I thought it was supposed to have been working on NPM for quite a while. On yarn, there is this bug:
https://github.com/yarnpkg/berry/issues/6305
that isn't marked fixed yet.
IIRC it broke with npm
via git bash
via VS Code.
But I looked closer at the old image and it looks like despite which
reporting the correct location, the error it spat out references yarn.
So I guess some environment caching nonsense was at play?
I continue to thing that this is a yarn bug. With a modern npm or pnpm, the correct command wrapper should be written.
Another way to solve this would be to document this case with "Yarn is broken. Do not use it to install peggy until bug 6305 is fixed."
Yet another approach would be to land #555 but add a new bug to remove that code if yarn's 6305 is fixed. That seems like the best short-term approach.
I searched peggy.cmd on my computer, i found it use "-S.exe" to load peggy whether "-S" exists or not:
env:
Is this situation a bug? it can works if i removed -S of ELSE case.