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

GitUp throwing 'npx not found' error on commit #1006

Open
gabcomby opened this issue Jun 13, 2024 · 5 comments
Open

GitUp throwing 'npx not found' error on commit #1006

gabcomby opened this issue Jun 13, 2024 · 5 comments

Comments

@gabcomby
Copy link

The project I work on has a pre-commit hook which uses an npx command. When I use regular Git on my console, everything works fine. I use NVM, Noda 20, and running 'npx-v' correctly gives me the currently installed npx version, which shows it is indeed installed. However, when committing with GitUp, I get the following error: npx: command not found.

I tried reinstalling a fresh version of Node 20 with NVM, but to no avail. Any clues here?

@Cykelero
Copy link

It's likely that when it executes your hooks, GitUp doesn't have access to your environment variables, such as PATH; which in turn means it can't find the npx executable.

As a workaround (and a way to confirm this is indeed the cause!), you could try running the app through Terminal, which makes it inherit your shell's env variables:

$ nohup /Applications/GitUp.app/Contents/MacOS/GitUp > /dev/null 2>&1 &

(adjust the path depending on where you've installed the app)

@gabcomby
Copy link
Author

@Cykelero when running the command, I get the following output, and my GitUp app doesn't launch:
[1] 52887
[1] + exit 127 $ nohup /Applications/GitUp.app/Contents/MacOS/GitUp > /dev/null 2>&1

@Cykelero
Copy link

Sorry about the confusion: the $ isn't part of the command, it's supposed to represent a shell prompt!
The actual command to copy and paste into Terminal starts at nohup, and it'll only work if GitUp is in the root Applications folder.

@gabcomby
Copy link
Author

Yeah sorry that's on me, I wasn't really thinking lmao. It works great, now I'm able to commit freely. Is there any way to give GitUp access to my PATH? It would be rgeat if I could avoid having to launch it via Terminal every time...

@Cykelero
Copy link

I don't know of an easier workaround, sorry. GitUp would have to be updated with the ability to import your environment variables, but that's kind of thorny, as it can have side-effects.

(some resources if someone wants to work on that feature: Nova's support page on the subject; a SO answer with an example implementation; and another related SO answer)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants