Comments (12)
this a regression from switching to launchd (watchman is supposed to capture your PATH at the time you launch it).
A workaround would be to edit ~/Library/LaunchAgents/com.github.facebook.watchman.plist
and add something like:
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>INSERT YOUR PATH HERE</string>
</dict>
(see man launchd.plist
for more on this file)
then:
launchctl unload -w ~/Library/LaunchAgents/com.github.facebook.watchman.plist
launchctl load -w ~/Library/LaunchAgents/com.github.facebook.watchman.plist
I'll work up a fix sometime in the coming week.
from watchman.
That's a little less palatable than my solution TBH, because it doesn't update as I update .profile, and as I've just updated to Yosemite and am having to reinstall my toolchain $PATH is a bit of a moving target ;-)
Thanks for the attention, I'll look forward to a pukka fix.
from watchman.
I just ran into this issue. All of the homebrew tools are unavailable by default. @wez's solution works. I did the following for PATH
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>$PATH:/usr/local/sbin:/usr/local/bin</string>
</dict>
from watchman.
Any updates on this? As a hack I've added a script to freeze my current env into the plist:
#Freeze the current env to the watchman config. This is a hack to get around
# https://github.com/facebook/watchman/issues/68
ENVIRONMENT=$(env | sed 's/=/<\/key><string>/' | sed -e 's/^/<key>/' | sed -e 's/$/<\/string>/')
echo $ENVIRONMENT
PLIST=~/Library/LaunchAgents/com.github.facebook.watchman.plist
# Remove the last two lines.
sed -i '' -e '$ d' $PLIST
sed -i '' -e '$ d' $PLIST
# replace the second to last line (previously "</dict>") with our environment +
# "</dict>"
echo "<key>EnvironmentVariables</key><dict>"$ENVIRONMENT"</dict></dict>" >> $PLIST
# Replace the last line
echo "</plist>" >> $PLIST
# Reload the watchman config
launchctl unload -w ~/Library/LaunchAgents/com.github.facebook.watchman.plist
launchctl load -w ~/Library/LaunchAgents/com.github.facebook.watchman.plist
but it's annoying to manually run that after any update to my env.
from watchman.
We have a diff that we'll land real soon now: https://reviews.facebook.net/D36045
from watchman.
This has landed; we're going to cut 3.1 with this fix in it soon and submit a PR to homebrew.
Meanwhile, you can do brew install --HEAD watchman
to pick up this fix.
from watchman.
I am still having an issue related to this (I think) using 3.3.0. I ran the following in my project root:
$ watchman watch `pwd`
$ watchman -- trigger `pwd` js '*.js' -- "browserify -o bundle.js"
But when I check the logs, I see a "No such file or directory" error. If I change the command to cat
or something, I see the output in the log as expected. The plist confirms that my path is getting picked up, but it doesn't seem to be able to find browserify.
from watchman.
I think you want this:
watchman -- trigger
pwdjs '*.js' -- browserify -o bundle.js
otherwise watchman will try to find the file named "browserify -o bundle.js" in your path and execute it
from watchman.
I tried that as well...no luck. I also tried it with various node-related commands and they all fail with the same error. Any other ideas? In the log file, I can see that the path is correct but it just doesn't seem to want to execute any command related to node.
from watchman.
I can't see your log file so I don't have any more context than you have shared on this closed issue.
I'd recommend just making a wrapper script that sets the appropriate things in the environment:
#!/bin/sh
PATH="$PATH:/some/where"
NODE_PATH="whatever is appropriate"
export PATH NODE_PATH
exec browserify -o bundle.js "$@"
from watchman.
I'll give that a shot. Thanks for your help!
from watchman.
For anybody looking - my hack to freeze the environment into the plist doesn't work so well anymore, but I wrote a new script to bake the current environment into a shell script:
#!/bin/bash -e -x
# Takes a bash script as the only argument, and prints the location of a new
# shell script that executes the given script with the current environment.
SCRIPT=`mktemp $TMPDIR"bake_env".XXXXXXXX`
ENVIRONMENT=$(env | sed "s/=\(.*\)\$/='\1'/g" | sed 's/^/;export /')
echo "#!/bin/bash -e" >> $SCRIPT
echo "true"$ENVIRONMENT >> $SCRIPT
ABS_PATH=`python -c "import os; print os.path.realpath('$1')"`
echo "exec $ABS_PATH \$@" >> $SCRIPT
chmod a+x $SCRIPT
echo $SCRIPT
When I want to run something with watchman I pass the target to run to that script, and then pass the output to watchman.
from watchman.
Related Issues (20)
- not bin HOT 1
- Publish new serde_bser version
- Installation error: ‘CertUtils’ has not been declared in ‘fizz (Ubuntu 22.04.3 LTS) HOT 3
- Unable to install watchman on arch HOT 2
- Prebuilt Linux binaries are unusable on any modern system HOT 5
- PCRE link is broken
- MacOS binaries missing HOT 5
- Hard dependency on Homebrew HOT 1
- Windows binaries are missing
- Unable to install pywatchman
- Unable to build watchman from source for ubuntu in the latest versions of releases HOT 1
- Could you provide `fc39.x86_64.rpm`? HOT 1
- Error from yarn gets written into plist
- Prebuilt macOS binaries no longer exist HOT 5
- `watchman list` command crashes with boost/icu4c HOT 1
- `watchman --version` always return `0.0.0` when building from source HOT 2
- Unable to resolve module @babel/runtime/helpers/interopRequireDefault
- Wiji
- Mistake in Readme file
- Build failure: `'apache::thrift::HandlerCallbackPtr' has not been declared`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from watchman.