[英]How to Compile React-Relay
I am trying to follow the official Relay documentation here .我正在尝试按照此处的官方 Relay 文档进行操作。
After installing React-Relay:安装 React-Relay 后:
npm install --save relay-runtime react-relay
npm install --save-dev relay-compiler graphql babel-plugin-relay
... and configuring package.json: ...并配置 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:我收到以下错误:
> test@0.1.0 start D:\xampp\htdocs\my-react\test
> npm run relay && react-scripts start
> test@0.1.0 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?如何正确运行中继编译器?
Apparently, I must remove 'npm run' in the last line of package.json:显然,我必须删除 package.json 最后一行中的“npm run”:
{
...
"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 $@"
...
},
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.