Postgraphile: can't install with yarn berry

Created on 16 Mar 2020  路  4Comments  路  Source: graphile/postgraphile

Error: graphile-utils tried to access graphile-build-pg (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

this seems to be related to a peer dependency not declared in the package.json

馃攣 revisit-in-v5

Most helpful comment

FWIW I managed to fix this by making the following addition to .yarnrc.yml

yarnPath: .yarn/releases/yarn-2.1.1.cjs
packageExtensions:
  postgraphile@^4.9.0:
    peer-dependencies:
      graphql: ">=0.9 <0.14 || ^14.0.2"
    dependencies:
      graphile-build: "^4.5.0"
      graphile-build-pg: "^4.5.0"
  graphile-build@^4.5.0:
    dependencies:
      graphql: ">=0.9 <0.14 || ^14.0.2"
  graphile-build-pg@^4.5.0:
    dependencies:
      graphql: ">=0.9 <0.14 || ^14.0.2"

All 4 comments

looks like graphile-build-pg is missing and it's required by https://github.com/graphile/graphile-engine/blob/master/packages/graphile-utils/package.json

FWIW I managed to fix this by making the following addition to .yarnrc.yml

yarnPath: .yarn/releases/yarn-2.1.1.cjs
packageExtensions:
  postgraphile@^4.9.0:
    peer-dependencies:
      graphql: ">=0.9 <0.14 || ^14.0.2"
    dependencies:
      graphile-build: "^4.5.0"
      graphile-build-pg: "^4.5.0"
  graphile-build@^4.5.0:
    dependencies:
      graphql: ">=0.9 <0.14 || ^14.0.2"
  graphile-build-pg@^4.5.0:
    dependencies:
      graphql: ">=0.9 <0.14 || ^14.0.2"

A small follow up to my last message...

For each graphile plugin, you need to include it as a dependency in .yarnrc.yml

e.g. to run yarn start with the following package.json

{
  "name": "foo",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "graphql": ">=0.9 <0.14 || ^14.0.2",
    "postgraphile": "^4.9.0",
    "postgraphile-plugin-connection-filter": "^2.0.0"
  },
  "scripts": {
    "start": "postgraphile -s app -c \"postgres://${API_DB_USER}:${API_DB_PASSWORD}@localhost:${API_DB_LOCAL_PORT}/${API_DB_API_DBNAME}\" --append-plugins postgraphile-plugin-connection-filter"
  }
}

You would need a .yarnrc.yml file similar to the following

yarnPath: .yarn/releases/yarn-2.1.1.cjs
packageExtensions:
  postgraphile@^4.9.0:
    peer-dependencies:
      graphql: ">=0.9 <0.14 || ^14.0.2"
    dependencies:
      graphile-build: "^4.5.0"
      graphile-build-pg: "^4.5.0"
      postgraphile-plugin-connection-filter: "*"
  graphile-build@^4.5.0:
    dependencies:
      graphql: ">=0.9 <0.14 || ^14.0.2"
  graphile-build-pg@^4.5.0:
    dependencies:
      graphql: ">=0.9 <0.14 || ^14.0.2"

Note postgraphile-plugin-connection-filter exists under postgraphile dependencies

I'd hope there's a better solution, but I'm not familiar enough with berry to know what that could be.

modify to * for all package I think it will be better:

// .yarnrc.yml
yarnPath: .yarn/releases/yarn-2.3.3.cjs
packageExtensions:
  postgraphile@*:
    peer-dependencies:
      graphql: "*"
    dependencies:
      graphile-build: "*"
      graphile-build-pg: "*"
      postgraphile-plugin-connection-filter: "*"
  graphile-build@*:
    dependencies:
      graphql: "*"
  graphile-build-pg@*:
    dependencies:
      graphql: "*"
Was this page helpful?
0 / 5 - 0 ratings

Related issues

fortm picture fortm  路  5Comments

safaiyeh picture safaiyeh  路  3Comments

giacomorebonato picture giacomorebonato  路  3Comments

james-ff picture james-ff  路  4Comments

Venryx picture Venryx  路  4Comments