Closed joncursi closed 5 years ago
This seems to be caused by changing required dependency in apollo package from "^14.2.1"
to "~14.2.1"
Which is caused by: https://github.com/apollographql/apollo-tooling/pull/1291
Even tough I've downgraded it does not fix anything for me :/
"dependencies": {
"@ckeditor/ckeditor5-build-classic": "^12.0.0",
"@ckeditor/ckeditor5-media-embed": "^11.1.0",
"@ckeditor/ckeditor5-react": "^1.1.1",
"@date-io/date-fns": "^1.3.6",
"@stfy/react-editor.js": "^0.1.5",
"@types/ckeditor__ckeditor5-core": "^11.0.2",
"@types/crypto-js": "^3.1.43",
"antd": "^3.19.1",
"apollo": "^2.12.2",
"apollo-boost": "^0.3.1",
"apollo-client": "^2.6.0",
"apollo-link-http": "1.5.11",
"apollo-upload-client": "^10.0.0",
"autoprefixer": "9.4.9",
"axios": "^0.18.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.4.2",
"babel-loader": "8.0.5",
"babel-preset-react-app": "^7.0.1",
"case-sensitive-paths-webpack-plugin": "2.2.0",
"chalk": "2.4.2",
"css-loader": "2.1.0",
"date-fns": "^2.0.0-alpha.27",
"dotenv": "6.2.0",
"dotenv-expand": "4.2.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "3.0.1",
"fork-ts-checker-webpack-plugin": "^0.5.2",
"formik": "^1.5.7",
"fs-extra": "7.0.1",
"graphql": "14.1.1",
"html-webpack-plugin": "^4.0.0-beta.5",
"jest": "^24.8.0",
"material-ui-formik-components": "^0.2.4",
"material-ui-pickers": "^2.2.4",
"moment": "^2.24.0",
"node-sass": "^4.10.0",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-loader": "3.0.0",
"promise": "8.0.2",
"ra-core": "^2.9.2",
"ra-data-graphcool": "^2.8.2",
"ra-data-graphql": "^2.8.2",
"ra-data-graphql-simple": "^2.8.2",
"ra-input-rich-text": "^2.9.2",
"raf": "3.4.1",
"react": "16.8.3",
"react-admin": "^2.9.2",
"react-apollo": "^2.5.6",
"react-dev-utils": "^7.0.3",
"react-dom": "16.8.2",
"react-intl": "^2.9.0",
"react-loader-spinner": "^2.3.0",
"react-router-dom": "^4.3.1",
"react-select": "^2.4.4",
"react-sticky": "^6.0.3",
"react-stripe-checkout": "^2.6.3",
"react-toastify": "^5.2.1",
"resolve": "1.10.0",
"sass-loader": "^7.1.0",
"source-map-loader": "^0.2.1",
"style-loader": "0.23.1",
"styled-components": "4.1.3",
"sw-precache-webpack-plugin": "0.11.5",
"terser-webpack-plugin": "^1.3.0",
"ts-jest": "24.0.0",
"ts-loader": "^5.3.3",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"tslint": "^5.17.0",
"tslint-config-prettier": "^1.18.0",
"tslint-react": "^3.2.0",
"url-loader": "1.1.2",
"webpack": "4.29.6",
"webpack-dev-server": "3.2.1",
"webpack-manifest-plugin": "2.0.4",
"whatwg-fetch": "3.0.0",
"yup": "^0.26.10"
},
"devDependencies": {
"@ant-design/icons": "^1.1.16",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"@types/graphql": "^14.0.7",
"@types/jest": "^24.0.13",
"@types/node": "^11.13.13",
"@types/react": "16.8.6",
"@types/react-dom": "^16.8.2",
"@types/react-intl": "^2.3.17",
"@types/react-router-dom": "^4.3.3",
"@types/styled-components": "^4.1.15",
"@types/yup": "^0.26.13",
"babel-plugin-react-intl": "^3.1.1",
"jest-haste-map": "^24.8.0",
"jest-resolve": "^24.8.0",
"prop-types": "^15.7.2",
"react-intl-translations-manager": "^5.0.3",
"react-test-renderer": "^16.8.6",
"typescript": "^3.5.1"
},
If this complete list could signifie somethinkg to you ?
If you are using npm:
node_modules/apollo/package.json
"graphql": "~14.2.1
package.json
to make sure it matches exactly what apollo is usingrm -rf node_modules/
npm i
npm dedupe
I changed my backend's folder structure around and started getting this error while using serverless-offline and refreshing the local version of my UI. The fix for me was to change this line in my webpack config
externals: [ nodeExternals() ],
to
externals: [ nodeExternals({ modulesDir: path.resolve(__dirname, 'node_modules') }) ],
This fix probably doesn't apply to you if you are using a standard folder structure. I don't even know why this worked.
@flippidippi dedupe can't work if we are in a monorepo submodule whith a local import as those imports will not have anything left in there node modules
If you are using npm:
Copy the version of graphql from your
node_modules/apollo/package.json
- For me at the time of writing it's
"graphql": "~14.2.1
- Paste that in your project's
package.json
to make sure it matches exactly what apollo is using- Run
rm -rf node_modules/
- Run
npm i
- Run
npm dedupe
In case anyone has a variable version like this 14.0.2 - 14.2.0 || ^14.3.1
,:
packadge.json
and in node_modules/apollo/packadge.json
node_modules/apollo/node_modules
node_modules/apollo/
node_modules/apollo/
@Sceat did you made it work for you in monorepo ?
@Sceat did you made it work for you in monorepo ?
Nop it's not possible, neither to link
other project using Graphql.js
this realm security is imo useless and makes things overcomplex, i resolved it by refactoring my whole monorepo to import 'graphql' in only one place. Note that this security also prevent us from using a commonjs library that use graphql & using it ourselve through esm, that said i also moved away from all that heavy apollo stuff which has enough line of code to sink the earth into a black hole :grin: good luck my friend, i opted to write my own graphql solution on top of the graphqljs lib
have you tried to use resolutions
in package.json ?
Yup, and all sort of others things like burning sand in a cup shouting chinese words but no success..
@Sceat well, it works for me now with apollo schema:download
but I have a small issue with apollo codegen:generate
, anyway, I have made resolutions
in top package.json
file and that did the fix
@Sceat well, it works for me now with
apollo schema:download
but I have a small issue withapollo codegen:generate
, anyway, I have maderesolutions
in toppackage.json
file and that did the fix
Would you mind sharing more about your 'resolutions' fix if possible? I'm not too sure how to set it up correctly. Thanks
This is not a fix as it doesn't work lol, i don't even remember exactly but it's like putting graphql with a precise version in the resolutions
field of the package.json
I made my own tools
To onlookers facing a similar problem, I ended up adding yarn resolutions to the base package.json in my yarn workspaces monorepo, specifying a version of GraphQL that previously worked fine.
'"resolutions": { "graphql": "^14.3.2" }"'
This fully resolved the duplicate GraphQL dependency error above.
@xsats Downgrading the version is not viable
@xsats Downgrading the version is not viable
Ok, just mentioning here as it is an appropriate fix for our particular scenario
Just to add on here, I was able to do what @xsats did, but using "graphql": "^15.0.0". There was no need to downgrade the version. All I did was
I got this exact error when my .npmrc did not have proper entries such as username and password. We are using jFrog to normalise package installation and .npmrc should be located at root. Hope this will help someone
I had a similar problem when using the apollo-link-schema package. You should just replace your modules with @apollo/client... https://www.apollographql.com/docs/react/migrating/apollo-client-3-migration/ . For example, apollo-link-schema is now @apollo/client/link/schema, etc. If you using Vue, then '@apollo/client/core' instead '@apollo/client'
I am unable to understand where this error comes from...
My command:
apollo codegen:generate -c apollo.config.js --target typescript --excludes=node_modules/* --includes=./src/apollo/queries/*.ts --tagName=gql --outputFlat src/graphql-schema
The error:
✖ Generating query files with 'typescript' target
→ spurious results.
Error: Cannot use GraphQLObjectType "QueryType" from another
module or realm.
My graphql dependencies:
npm ls graphql
my-package
├─┬ @apollo/client@3.5.10
│ ├─┬ @graphql-typed-document-node/core@3.1.1
│ │ └── graphql@15.8.0 deduped
│ └── graphql@15.8.0 deduped
├─┬ @vue/apollo-composable@4.0.0-alpha.16
│ └── graphql@15.8.0 deduped
├─┬ apollo@2.33.10
│ ├─┬ @apollographql/apollo-tools@0.5.3
│ │ └── graphql@15.8.0 deduped
│ ├─┬ apollo-graphql@0.9.6
│ │ └── graphql@15.8.0 deduped
│ ├─┬ apollo-language-server@1.26.8
│ │ ├─┬ @apollo/federation@0.27.0
│ │ │ └── graphql@15.8.0 deduped
│ │ ├─┬ @apollographql/graphql-language-service-interface@2.0.2
│ │ │ ├─┬ @apollographql/graphql-language-service-parser@2.0.2
│ │ │ │ └── graphql@14.7.0 deduped
│ │ │ ├─┬ @apollographql/graphql-language-service-types@2.0.2
│ │ │ │ └── graphql@14.7.0 deduped
│ │ │ ├─┬ @apollographql/graphql-language-service-utils@2.0.2
│ │ │ │ └── graphql@14.7.0 deduped
│ │ │ └── graphql@14.7.0 deduped
│ │ ├─┬ apollo-link-error@1.1.13
│ │ │ └─┬ apollo-link-http-common@0.2.16
│ │ │ └── graphql@15.8.0 deduped
│ │ ├─┬ apollo-link-http@1.5.17
│ │ │ └── graphql@15.8.0 deduped
│ │ ├─┬ apollo-link@1.2.14
│ │ │ ├─┬ apollo-utilities@1.3.4
│ │ │ │ └── graphql@15.8.0 deduped
│ │ │ └── graphql@15.8.0 deduped
│ │ ├─┬ apollo-server-errors@2.5.0
│ │ │ └── graphql@15.8.0 deduped
│ │ └── graphql@14.7.0
│ ├─┬ graphql-tag@2.12.4
│ │ └── graphql@15.8.0 deduped
│ └── graphql@15.8.0 deduped
├─┬ graphql-tag@2.12.6
│ └── graphql@15.8.0 deduped
└── graphql@15.8.0
All use graphql@15.8.0 except some sub-dependencies of apollo
This still seems to be an issue, should we re-open?
@amritk This is still an issue for me as well.
After upgrading from
apollo@2.12.2
-->apollo@2.12.3
, I started receiving the following error while trying to download my schema:Downgrading back to
2.12.2
causes the error to go away.