1

I am trying to follow the official Relay documentation here.

After installing React-Relay:

npm install --save relay-runtime react-relay
npm install --save-dev relay-compiler graphql babel-plugin-relay

... and configuring package.json:

{
  ...
  "scripts": {
    ...
    "start": "npm run relay && react-scripts start",
    "build": "npm run relay && react-scripts build",
    "relay": "npm run relay-compiler --schema schema.graphql --src ./src/ --watchman false $@"
    ...
  },
  ...
}

when I ran:

npm start

I got the following error:

> [email protected] start D:\xampp\htdocs\my-react\test
> npm run relay && react-scripts start


> [email protected] relay D:\xampp\htdocs\my-react\test
> npm run relay-compiler --schema schema.graphql --src ./src/ --watchman false $@

npm ERR! missing script: relay-compiler

How can I correctly run relay-compiler?

1 Answer 1

1

Apparently, I must remove 'npm run' in the last line of package.json:

{
  ...
  "scripts": {
    ...
    "start": "npm run relay && react-scripts start",
    "build": "npm run relay && react-scripts build",
    "relay": "relay-compiler --schema schema.graphql --src ./src/ --watchman false $@"
    ...
  },
  ...
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.