jamofbob Posted February 4, 2020 Posted February 4, 2020 I am trying to write an Alfred Workflow that creates a new react app. All the commands below are working fine EXCEPT for "npx create-react-app", anyone got this to work before? Many thanks... cd /Users/jameshusband/Development mkdir {query} cd {query} npx create-react-app my-app touch index.html
deanishe Posted February 4, 2020 Posted February 4, 2020 You have to use /usr/local/bin/npx (or whatever the full path to the command is). Chris Messina 1
jamofbob Posted February 5, 2020 Author Posted February 5, 2020 Sorry I failed to mention in OP that i have already tried pointing directly to the binary, Run Script looks like this: cd /Users/theuser/development /usr/local/bin/npx create-react-app my-app
jamofbob Posted February 5, 2020 Author Posted February 5, 2020 I have managed to solve the issue by setting PATH variable. Found the Alfred Workflow Debug tool, very useful!! cd /Users/jameshusband/development PATH=/usr/local/bin npx create-react-app application
deanishe Posted February 5, 2020 Posted February 5, 2020 Ah, right. I guess npx calls other tools. Glad you got it working. FWIW, you should generally use PATH=/usr/local/bin:$PATH so as not to remove directories and break things.
jamofbob Posted February 6, 2020 Author Posted February 6, 2020 (edited) Many thanks for helping, life saver with the correct setting of PATH! Edited February 6, 2020 by jamofbob
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now