-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Postinstall script fails with PNPM workspaces due to npm ERR! Cannot read properties of null (reading 'matches') #14944
Copy link
Copy link
Closed
Labels
bug/0-unknownBug is new, does not have information for reproduction or reproduction could not be confirmed.Bug is new, does not have information for reproduction or reproduction could not be confirmed.kind/bugA reported bug.A reported bug.topic: pnpmtopic: pnpm workspaces
Milestone
Description
Bug description
When running pnpm install in a monorepo, with this structure
packages
server
prisma
schema.prisma
shared-utils
package.json
web
package.json
pnpm-workspace.yaml
package.json
I get this error:
#0 2.239
#0 2.239 > @hub/shared-utils@1.0.0 generate /app/packages/shared-utils
#0 2.239 > pnpm prisma generate
#0 2.239
#0 36.80 Prisma schema loaded from ../server/prisma/schema.prisma
#0 451.1 npm ERR! Cannot read properties of null (reading 'matches')
#0 451.2
#0 451.2 npm ERR! A complete log of this run can be found in:
#0 451.2 npm ERR! /root/.npm/_logs/2022-08-23T02_34_57_814Z-debug-0.log
#0 451.2 Error: Command failed with exit code 1: npm install -D prisma@3.15.2
#0 451.3 undefined
#0 451.3 /app/packages/shared-utils:
#0 451.3 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL @hub/shared-utils@1.0.0 generate: `pnpm prisma generate`
#0 451.3 Exit status 1
my package shared-utils installs prisma, web depends on shared-utils
shared-utils has a custom postinstall script, which generates Prisma client from custom location(from server package).
This is package.json of shared-utils
{
"name": "@example/shared-utils",
"version": "1.0.0",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"private": true,
"license": "MIT",
"scripts": {
"build": "rm -rf dist && tsc --build",
"test": "jest",
"precommit": "eslint --ext .ts \"*/**/*\" --fix && prettier --write .",
"postinstall": "pnpm prisma generate"
},
"dependencies": {
"currency.js": "^2.0.4",
"@prisma/client": "3.15.2",
"date-fns": "^2.28.0"
},
"devDependencies": {
"@example/eslint-config": "1.0.0",
"@example/prettier-config": "1.0.0",
"prisma": "3.15.2"
},
"prisma": {
"schema": "../server/prisma/schema.prisma"
},
"prettier": "@example/prettier-config",
"jest": {
"preset": "ts-jest",
"roots": [
"src"
],
"modulePaths": [
"src"
],
"moduleDirectories": [
"node_modules"
]
}
}
How to reproduce
- Go to project root.
- Run
pnpm install - See error
Expected behavior
pnpm install installs packages, and Prisma schema is generated automatically
Prisma information
Environment & setup
- OS: Mac OS,
- Database: PostgreSQL
- Node.js version: 16.13.1
Prisma Version
3.15.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug/0-unknownBug is new, does not have information for reproduction or reproduction could not be confirmed.Bug is new, does not have information for reproduction or reproduction could not be confirmed.kind/bugA reported bug.A reported bug.topic: pnpmtopic: pnpm workspaces