Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Cannot compile example #58

Open
fdietze opened this issue Apr 2, 2021 · 0 comments · May be fixed by #59
Open

Cannot compile example #58

fdietze opened this issue Apr 2, 2021 · 0 comments · May be fixed by #59

Comments

@fdietze
Copy link

fdietze commented Apr 2, 2021

I'm trying to run the example like this:

sbt example/fastOptJS::startWebpackDevServer

And then I get the following error:

[info] Loading settings for project global-plugins from plugins.sbt ...
[info] Loading global plugins from /home/felix/.sbt/1.0/plugins
[info] Loading settings for project apollo-scalajs-build from plugins.sbt ...
[info] Loading project definition from /tmp/tmp.4XopoXrhQQ/apollo-scalajs/project
[info] Loading settings for project apollo-scalajs from build.sbt ...
[info] Loading settings for project example from build.sbt ...
[info] Loading settings for project tests from build.sbt ...
[info] Loading settings for project react from build.sbt ...
[info] Loading settings for project core from build.sbt ...
[info] Set current project to apollo-scalajs (in build file:/tmp/tmp.4XopoXrhQQ/apollo-scalajs/)
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
Loading Apollo Project [started]
Loading Apollo Project [completed]
Generating query files [started]
Generating query files with 'scala' target [title changed]
Generating query files with 'scala' target [failed]
→ Cannot use GraphQLObjectType "Query" from another module or realm.

Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.

https://yarnpkg.com/en/docs/selective-version-resolutions

Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.
    Error: Cannot use GraphQLObjectType "Query" from another module or realm.

    Ensure that there is only one instance of "graphql" in the node_modules
    directory. If different versions of "graphql" are the dependencies of 
    other
    relied on modules, use "resolutions" to ensure only one version is 
    installed.

    https://yarnpkg.com/en/docs/selective-version-resolutions
  | => example / Compile / managedSources 3s
    Duplicate "graphql" modules cannot be used at the same time since 
    different
    versions may have different capabilities and behavior. The data from one
    version used in the function from another could produce confusing and
    spurious results.
[info] Compiling 4 Scala sources to /tmp/tmp.4XopoXrhQQ/apollo-scalajs/example/target/scala-2.12/classes ...
[error] [E-1] IO error while decoding /tmp/tmp.4XopoXrhQQ/apollo-scalajs/example/target/scala-2.12/src_managed/main/graphql.scala with UTF-8: /tmp/tmp.4XopoXrhQQ/apollo-scalajs/example/target/scala-2.12/src_managed/main/graphql.scala (No such file or directory)
[error]       Please try specifying another one using the -encoding option
[info] Legend: Ln = line n, Cn = column n, En = error n
[info] Updating NPM dependencies
[info] added 19 packages, removed 45 packages, changed 21 packages, and audited 1119 packages in 11s
[info] 59 packages are looking for funding
[info]   run `npm fund` for details
[info] 10 vulnerabilities (4 low, 3 moderate, 3 high)
[info] To address issues that do not require attention, run:
[info]   npm audit fix
[info] To address all issues, run:
[info]   npm audit fix --force
[info] Run `npm audit` for details.
[error] (example / Compile / compileIncremental) Compilation failed
[error] Total time: 17 s, completed Apr 2, 2021 6:50:00 PM

What I already tried:

  • useYarn := true
  • check node_modules folders (project and global) and lock-files for other graphql dependencies
  • upgrading apollo dependencies apollo and @apollo/client
  • npmResolutions in Compile := Map("graphql" -> "14.7.0") in build.sbt

all versions look fine (with npmResultions):

/tmp/tmp.4XopoXrhQQ/apollo-scalajs/example/target/scala-2.12/scalajs-bundler/main on  master [!?] 
❯ npm ls graphql
main@ /tmp/tmp.4XopoXrhQQ/apollo-scalajs/example/target/scala-2.12/scalajs-bundler/main
├─┬ @apollo/client@3.2.4
│ ├─┬ @graphql-typed-document-node/core@3.1.0
│ │ └── graphql@14.7.0 deduped
│ ├─┬ graphql-tag@2.12.3
│ │ └── graphql@14.7.0 deduped
│ └── graphql@14.7.0
└─┬ apollo@2.31.0
  ├─┬ apollo-graphql@0.6.1
  │ └── graphql@14.7.0 deduped
  ├─┬ apollo-language-server@1.25.2
  │ ├─┬ @apollo/federation@0.20.7
  │ │ └── graphql@14.7.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@14.7.0 deduped
  │ ├─┬ apollo-link-http@1.5.17
  │ │ └── graphql@14.7.0 deduped
  │ ├─┬ apollo-link@1.2.14
  │ │ ├─┬ apollo-utilities@1.3.4
  │ │ │ └── graphql@14.7.0 deduped
  │ │ └── graphql@14.7.0 deduped
  │ ├─┬ apollo-server-errors@2.4.2
  │ │ └── graphql@14.7.0 deduped
  │ └── graphql@14.7.0 deduped
  ├─┬ graphql-tag@2.11.0
  │ └── graphql@14.7.0 deduped
  └── graphql@14.7.0 deduped

Seems to be related to: graphql/graphql-js#491

@fdietze fdietze linked a pull request Apr 2, 2021 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant