【发布时间】:2019-07-08 08:15:59
【问题描述】:
我没有任何 UI 框架。只是一个简单的 Nodejs 脚本,我需要在其中查询 GraphQL。
代码:
const ApolloClient = require('apollo-client')
const client = new ApolloClient()
错误信息:
TypeError: ApolloClient is not a constructor
包.json:
{
...
"dependencies": {
"apollo-client": "^2.4.13",
"graphql": "^14.1.1",
"graphql-tag": "^2.10.1"
},
}
节点:v8.9.4
我用谷歌搜索了一段时间人们有这个问题主要是因为ApolloClient is no longer in react-apollo. You have to import it from 'apollo-client'
我从apollo-client 导入为const ApolloClient = require('apollo-client')
有什么想法吗?谢谢!
【问题讨论】: