我想安裝一個graphql項目。我已經運行了GraphQL服務器並嘗試設置中繼環境。我從這裏https://github.com/graphcool/babel-plugin-react-relay遵循的指示,但是當我嘗試運行項目中,我得到以下錯誤:巴別爾插件反應繼電器
[email protected] start /Users/JKB/Sites/Project nodemon --watch server --exec babel-node -- server/index.js
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /Users/JKB/Sites/project/server/**/*
[nodemon] starting `babel-node server/index.js`
/Users/JKB/Sites/project/node_modules/babel-plugin-react-relay/lib/index.js:27
throw error;
^
Error
at ClientRequest.<anonymous> (/Users/JKB/Sites/project/node_modules/node-fetch/index.js:133:11)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at TLSSocket.socketCloseListener (_http_client.js:285:9)
at emitOne (events.js:101:20)
at TLSSocket.emit (events.js:188:7)
at _handle.close (net.js:501:12)
at TCP.done [as _onclose] (_tls_wrap.js:325:7)
at module.exports.loopWhile (/Users/JKB/Sites/project/node_modules/deasync/index.js:72:22)
at exports.default (/Users/JKB/Sites/project/node_modules/babel-plugin-react-relay/lib/index.js:21:26)
[nodemon] app crashed - waiting for file changes before starting...
我已在.babelrc
{
"presets": [ "es2015", "react" ],
"plugins": [ "react-html-attrs", "react-relay" ]
}
下,我已經出口了環境變量:
export GRAPHQL_ENDPOINT =「http:// localhost:3000/graphql」
及以下包版本附件:
"babel-relay-plugin": "^0.10.0"
"babel-plugin-react-relay": "^0.10.0"
"react-relay": "^0.10.0"
當我嘗試重新安裝我得到以下警告 - 不知道他們是否有關係..
[email protected] /Users/JKB/Sites/project
├── [email protected]
└── UNMET PEER DEPENDENCY [email protected] invalid
npm WARN [email protected] requires a peer of [email protected] but none was installed.
npm WARN [email protected] No repository field.
➜ project git:(master) ✗ npm install -D babel-relay-plugin
[email protected] /Users/JKB/Sites/project
└── UNMET PEER DEPENDENCY [email protected]
npm WARN [email protected] requires a peer of [email protected] but none was installed.
npm WARN [email protected] No repository field.
npm ERR! code 1
對不起,應該已經明確了。我已經有了在本地主機端口3000上運行的GraphQL服務器。我正在嘗試設置中繼環境,這就是我得到的錯誤。 –
根據上面的例子,你是否嘗試過不使用'babel-relay-react-plugin'並且只使用'babel-relay-plugin'? – danielfeelfine