graphqlyarnpkgrelayreact-relay

'ENOTDIR' error while running relay-compiler with yarn


I am trying to make an application with react-relay following the step-by-step guide on the relay documentation. After running yarn install and adding the yarn relay script which runs "relay-compiler --src ./src --schema ./schema.graphql --language typescript". And I was getting an ENOTDIR error as below:

    $ relay-compiler --src ./src --schema ./schema.graphql --language typescript
    Error: spawn ENOTDIR
        at ChildProcess.spawn (node:internal/child_process:412:11)
        at Object.spawn (node:child_process:698:9)
        at /home/Documents/workspace/react-relay/node_modules/relay-compiler/bin/relay-compiler:1841:31
        at new Promise (<anonymous>)
        at Function.isAvailable (/home/Documents/workspace/react-relay/node_modules/relay-compiler/bin/relay-compiler:1835:12)
        at /home/Documents/workspace/relay-test/node_modules/relay-compiler/bin/relay-compiler:8221:61
        at Generator.next (<anonymous>)
        at asyncGeneratorStep (/home/Documents/workspace/react-relay/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
        at _next (/home/Documents/workspace/react-relay/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
        at /home/Documents/workspace/react-relay/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7
    error Command failed with exit code 1.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I have then updated my versions of node, npm, yarn. And tried cloning some relay example projects from github, and I was getting the same error message with all repos that uses relay.


Solution

  • Turned out it was because I don't have the required watchman package, this was resolved by installing Watchman on my machine.