Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm ERR! Cannot read properties of null (reading 'matches') #1252

Closed
AntonOfTheWoods opened this issue May 10, 2024 · 3 comments
Closed

npm ERR! Cannot read properties of null (reading 'matches') #1252

AntonOfTheWoods opened this issue May 10, 2024 · 3 comments

Comments

@AntonOfTheWoods
Copy link
Contributor

I am getting the following error when trying to generate the client:

...
> npx electric-sql generate --service $ELECTRIC_SERVICE_URL --proxy $ELECTRIC_PG_PROXY_URL

Generating Electric client...
Service URL: http://localhost:31133
Proxy URL: postgresql://postgres:********@localhost:31432/postgres
Error: Command failed: node /home/anton/dev/ntc/transcrobes/frontend/node_modules/.pnpm/[email protected]/node_modules/prisma/build/index.js generate --schema=".electric_migrations_tmp_XXXXXXrgQi9s/prisma/schema.prisma"
npm ERR! Cannot read properties of null (reading 'matches')

npm ERR! A complete log of this run can be found in: /home/anton/.npm/_logs/2024-05-10T02_01_41_719Z-debug-0.log
Error: Command failed with exit code 1: npm install @prisma/[email protected]

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:530:35)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'node /home/anton/dev/ntc/transcrobes/frontend/node_modules/.pnpm/[email protected]/node_modules/prisma/build/index.js generate --schema=".electric_migrations_tmp_XXXXXXrgQi9s/prisma/schema.prisma"'
}
generate command failed: Generator script exited with error code: 1
 ELIFECYCLE  Command failed with exit code 1.

with the end of the log being:

596 timing command:install Completed in 38661ms
597 verbose stack TypeError: Cannot read properties of null (reading 'matches')
597 verbose stack     at Link.matches (/home/anton/.asdf/installs/nodejs/20.12.2/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js:1115:41)
597 verbose stack     at Link.canDedupe (/home/anton/.asdf/installs/nodejs/20.12.2/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js:1069:15)
597 verbose stack     at PlaceDep.pruneDedupable (/home/anton/.asdf/installs/nodejs/20.12.2/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:426:14)
597 verbose stack     at new PlaceDep (/home/anton/.asdf/installs/nodejs/20.12.2/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:278:14)
597 verbose stack     at new PlaceDep (/home/anton/.asdf/installs/nodejs/20.12.2/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:314:26)
597 verbose stack     at #buildDepStep (/home/anton/.asdf/installs/nodejs/20.12.2/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:940:18)
597 verbose stack     at async Arborist.buildIdealTree (/home/anton/.asdf/installs/nodejs/20.12.2/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:203:7)
597 verbose stack     at async Promise.all (index 1)
597 verbose stack     at async Arborist.reify (/home/anton/.asdf/installs/nodejs/20.12.2/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:154:5)
597 verbose stack     at async Install.exec (/home/anton/.asdf/installs/nodejs/20.12.2/lib/node_modules/npm/lib/commands/install.js:153:5)
597 verbose stack     at async module.exports (/home/anton/.asdf/installs/nodejs/20.12.2/lib/node_modules/npm/lib/cli-entry.js:61:5)
598 verbose cwd /home/anton/dev/ntc/transcrobes/frontend/.electric_migrations_tmp_XXXXXXrgQi9s/prisma
599 verbose Linux 5.15.146.1-microsoft-standard-WSL2
600 verbose node v20.12.2
601 verbose npm  v10.5.0
602 error Cannot read properties of null (reading 'matches')
603 verbose exit 1
604 timing npm Completed in 38794ms
605 verbose unfinished npm timer reify 1715306501851
606 verbose unfinished npm timer reify:loadTrees 1715306501855
607 verbose unfinished npm timer idealTree:buildDeps 1715306507273
608 verbose unfinished npm timer idealTree:node_modules/.pnpm/@[email protected]/node_modules/@discoveryjs/json-ext 1715306539871
609 verbose code 1
610 error A complete log of this run can be found in: /home/anton/.npm/_logs/2024-05-10T02_01_41_719Z-debug-0.log

The server logs look alright:

02:01:38.527 pid=<0.4103.0> [info] GET /api/migrations
02:01:38.554 pid=<0.4103.0> [info] Sent 200 in 28ms
02:01:38.578 pid=<0.4103.0> [info] GET /api/migrations
02:01:38.596 pid=<0.4103.0> [info] Sent 200 in 18ms
02:01:39.030 pid=<0.4105.0> proxy_session_id=17 [warning] Not validating user "prisma"
02:01:39.031 pid=<0.4105.0> proxy_session_id=17 [info] Initialising injector in capture mode %Electric.Postgres.Proxy.Injector.Prisma{config: %Electric.Postgres.Proxy.Prisma{server_version: {"14.9", 140009}}, prepared_statements: %{}, active_statement: nil, portals: %{}}
02:01:39.036 pid=<0.4105.0> proxy_session_id=17 [info] Upstream connection is ready to accept queries
02:01:39.041 pid=<0.4105.0> proxy_session_id=17 [info] Matched prisma introspection query to Elixir.Electric.Postgres.Proxy.Prisma.Query.NamespaceV5_2
02:01:39.043 pid=<0.4105.0> proxy_session_id=17 [info] Matched prisma introspection query to Elixir.Electric.Postgres.Proxy.Prisma.Query.TableListV4_8
02:01:39.045 pid=<0.4105.0> proxy_session_id=17 [info] Matched prisma introspection query to Elixir.Electric.Postgres.Proxy.Prisma.Query.TypeV4_802:01:39.047 pid=<0.4105.0> proxy_session_id=17 [info] Matched prisma introspection query to Elixir.Electric.Postgres.Proxy.Prisma.Query.ColumnV4_8
02:01:39.050 pid=<0.4105.0> proxy_session_id=17 [info] Matched prisma introspection query to Elixir.Electric.Postgres.Proxy.Prisma.Query.ForeignKeyV4_8
02:01:39.053 pid=<0.4105.0> proxy_session_id=17 [info] Matched prisma introspection query to Elixir.Electric.Postgres.Proxy.Prisma.Query.IndexV4_8
02:01:39.055 pid=<0.4105.0> proxy_session_id=17 [info] Matched prisma introspection query to Elixir.Electric.Postgres.Proxy.Prisma.Query.ViewV4_802:01:39.056 pid=<0.4105.0> proxy_session_id=17 [info] Matched prisma introspection query to Elixir.Electric.Postgres.Proxy.Prisma.Query.FunctionV5_2
02:01:39.058 pid=<0.4105.0> proxy_session_id=17 [info] Matched prisma introspection query to Elixir.Electric.Postgres.Proxy.Prisma.Query.ExtensionV5_2
02:01:39.060 pid=<0.4105.0> proxy_session_id=17 [info] Matched prisma introspection query to Elixir.Electric.Postgres.Proxy.Prisma.Query.SequenceV5_2
Copy link

linear bot commented May 10, 2024

@AntonOfTheWoods AntonOfTheWoods changed the title client generation bug npm ERR! Cannot read properties of null (reading 'matches') May 10, 2024
@samwillis
Copy link
Contributor

Hey @AntonOfTheWoods

Could you post the schema you are using, and the versions of the client+server?

@AntonOfTheWoods
Copy link
Contributor Author

AntonOfTheWoods commented May 10, 2024

Ok, so that's REALLY annoying. I'm physically behind a GFW and that means npm is an absolute nightmare. pnpm (with a vpn) works fine but if you don't overtly install @prisma/[email protected] with pnpm then the generator will try and download it with npm. I'm picking somehow that fails but the code still continues or something like that - in any case, it results in an incomprehensible error message that completely goes away if I manually install @prisma/[email protected] in my project with pnpm.

EDIT: actually I might have had an old version somewhere in node_modules, which is where I got this error from. After doing some cleaning, later attempts actually froze - after generating the .electric... directory with what looked to be valid output files - and didn't end up giving errors at all. So I guess that was where it was attempting to download or something. But I really have no idea... In any case, it is not worth pursuing for my highly unusual dev situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants