npm start failed: failed to parse query: unknown expression term 'dirname'
I'm having trouble with the newest 0.4.2 release. When I run npm start, it gives me the following error:
ERROR failed to parse query: unknown expression term 'dirname'
{"watchmanResponse":{"version":"3.1.0","error":"failed to parse query: unknown expression term 'dirname'"}}
Error: failed to parse query: unknown expression term 'dirname'
at null.<anonymous> (/Users/skyline/Projects/ZhihuDaily/node_modules/react-native/node_modules/sane/node_modules/fb-watchman/index.js:84:23)
at emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Readable.push (_stream_readable.js:126:10)
at Transform.push (_stream_transform.js:140:32)
at JSONStream._transform (/Users/skyline/Projects/ZhihuDaily/node_modules/react-native/node_modules/sane/node_modules/fb-watchman/node_modules/json-stream/lib/json-stream.js:30:14)
at Transform._read (_stream_transform.js:179:10)
at Transform._write (_stream_transform.js:167:12)
at doWrite (_stream_writable.js:301:12)
at writeOrBuffer (_stream_writable.js:288:5)
at Writable.write (_stream_writable.js:217:11)
at Socket.ondata (_stream_readable.js:540:20)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at Pipe.onread (net.js:529:20)
However, another project using 0.4.1 works fine.
I'm using watchman 3.1.0.
Sorry I don't know
@skyline75489 - is this happening on a brand new 0.4.2 project? react-native init SomeNewProject?
Yes, the same thing is happening to me on a brand new project.
Yep, brand new project created by react-native init.
Faced the same problem. Uninstalling watchman and re-installing it fixed it for me.
brew uninstall watchman
brew install --HEAD watchman
@amasad this seems like something that you are good at :smile:, any ideas?
Had the same issue after recently updating my OS X dotfiles and was able to resolve it using the method suggested by @cparmar82 with the --force flag on the uninstall.
I also fixed it using the method @cparmar82 suggested. While reinstalling watchman, the pcre dependency was upgraded from 8.36 to 8.37. Maybe this has something to do with the error?
@cparmar82’s method worked for me too. Thanks!
Great, thanks for the fix @cparmar82!