You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reading the documentation at https://peggyjs.org/documentation.html#using-the-parser:
It gives the example:
$ peggy arithmetics.pegjs
However, there are 2 ways to install an npm module - either globally, using npm install -g or locally, using npm install or npm install -D. This page (earlier) recommends installing locally, to which I agree. But when you do that, you have to use npx peggy... to run from the command line, so this example fails. There is, I admit, an earlier example of getting help that does use npx. Also, the earlier example of setting up a script key in your package.json file works, even though it doesn't use npx. This is some kind of magic that I do not approve of. What I'm saying is that I'd prefer if it used npx just so that users aren't tempted to run the command as presented from the command line, which would fail. Just my 2 cents.
BTW, I'm on Windows 11 and use the git bash shell, so maybe other shells would find the peggy command from the command shell without using npx - I just don't know. But I would get the message "bash: peggy: command not found"
The text was updated successfully, but these errors were encountered:
I'll add npx to the examples. Why it works in package.json is that npm adds node_modules/.bin to your path automatically, on all platforms. Not using npx in your package.json file is idiomatic nodejs.
Reading the documentation at
https://peggyjs.org/documentation.html#using-the-parser
:It gives the example:
However, there are 2 ways to install an npm module - either globally, using
npm install -g
or locally, usingnpm install
ornpm install -D
. This page (earlier) recommends installing locally, to which I agree. But when you do that, you have to usenpx peggy...
to run from the command line, so this example fails. There is, I admit, an earlier example of getting help that does use npx. Also, the earlier example of setting up ascript
key in your package.json file works, even though it doesn't use npx. This is some kind of magic that I do not approve of. What I'm saying is that I'd prefer if it used npx just so that users aren't tempted to run the command as presented from the command line, which would fail. Just my 2 cents.BTW, I'm on Windows 11 and use the git bash shell, so maybe other shells would find the peggy command from the command shell without using npx - I just don't know. But I would get the message "bash: peggy: command not found"
The text was updated successfully, but these errors were encountered: