作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 graphql 后端(elixir/phoenix)设置 React/Apollo 前端。我做了 npm install apollo-boost react-apollo graphql --save
,然后尝试在我的 index.js 中 import ApolloClient from "apollo-boost";
但我得到了
Uncaught Error: Cannot find module 'graphql' from 'apollo-link-state/lib/bundle.umd.js'
at require (app.js:61)
at expanded (app.js:34)
at app.js:148
at connectionRemoveConfig.test (bundle.umd.js:6)
at bundle.umd.js:9
at bundle.umd.js:151
at initModule (app.js:42)
at require (app.js:59)
at expanded (app.js:34)
at app.js:148
在我的浏览器控制台中。我找不到任何相关问题。你能指出哪里出了问题吗?这是我的package.json
。
{
"repository": {},
"license": "MIT",
"scripts": {
"deploy": "brunch build --production",
"watch": "brunch watch --stdin"
},
"dependencies": {
"apollo-boost": "^0.1.16",
"babel-preset-react": "^6.24.1",
"graphql": "^14.0.2",
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html",
"react": "^16.5.1",
"react-apollo": "^2.1.11",
"react-dom": "^16.5.1"
},
"devDependencies": {
"babel-brunch": "6.1.1",
"brunch": "2.10.9",
"clean-css-brunch": "2.10.0",
"uglify-js-brunch": "2.10.0"
}
}
感谢您的宝贵时间。
最佳答案
我通过单独安装它们解决了这个问题。npm install apollo-client apollo-cache-inmemory apollo-link-http react-apollo graphql-tag graphql --save
关于reactjs - 导入错误 : Cannot find module 'graphql' from 'apollo-link-state/lib/bundle. umd.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52352612/
我是一名优秀的程序员,十分优秀!