Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct documentation #478

Closed
johndeighan opened this issue Feb 15, 2024 · 1 comment
Closed

correct documentation #478

johndeighan opened this issue Feb 15, 2024 · 1 comment
Assignees

Comments

@johndeighan
Copy link

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"

@hildjj hildjj self-assigned this Feb 15, 2024
@hildjj
Copy link
Contributor

hildjj commented Feb 15, 2024

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.

@hildjj hildjj closed this as completed in 1aa1b52 Feb 23, 2024
hildjj added a commit that referenced this issue Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants