prisma: ERR_PNPM_BAD_PACKAGE_JSON : Invalid name: ".prisma/client"
Bug description
After upgrading from prisma 3.14.0 to 3.15.2 with pnpm, I’m unable to install new packages. When trying to install a new package, I get the error : ERR_PNPM_BAD_PACKAGE_JSON /myproject/node_modules/@prisma/client/package.json: Invalid name: ".prisma/client"
Taking a look at node_modules/@prisma/client/package.json
it shows the following:
version 3.14.0:
{
"name": "@prisma/client",
"version": "3.14.0",
"description": "Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports MySQL, PostgreSQL, MariaDB, SQLite databases.",
"keywords": [
"orm",
"prisma2",
"prisma",
"client",
"query",
"database",
"sql",
"postgres",
"postgresql",
"mysql",
"sqlite",
"mariadb",
"mssql",
"typescript",
"query-builder"
],
"main": "index.js",
"browser": "index-browser.js",
"types": "index.d.ts",
"license": "Apache-2.0",
"engines": {
"node": ">=12.6"
},
"homepage": "https://www.prisma.io",
"repository": {
"type": "git",
"url": "https://github.com/prisma/prisma.git",
"directory": "packages/client"
},
"author": "Tim Suchanek <suchanek@prisma.io>",
"maintainers": [
"Joël Galeran <galeran@prisma.io>",
"Pierre-Antoine Mills <mills@prisma.io>",
"Alexey Orlenko <orlenko@prisma.io>"
],
"bugs": "https://github.com/prisma/prisma/issues",
"files": [
"README.md",
"runtime",
"scripts",
"generator-build",
"index.js",
"index.d.ts",
"index-browser.js"
],
"devDependencies": {
"@jest/test-sequencer": "28.1.0",
"@microsoft/api-extractor": "7.19.3",
"@opentelemetry/api": "1.0.3",
"@prisma/debug": "3.14.0",
"@prisma/engine-core": "3.14.0",
"@prisma/engines": "3.14.0-36.2b0c12756921c891fec4f68d9444e18c7d5d4a6a",
"@prisma/fetch-engine": "3.14.0-36.2b0c12756921c891fec4f68d9444e18c7d5d4a6a",
"@prisma/generator-helper": "3.14.0",
"@prisma/get-platform": "3.14.0-36.2b0c12756921c891fec4f68d9444e18c7d5d4a6a",
"@prisma/migrate": "3.14.0",
"@prisma/sdk": "3.14.0",
"@swc/core": "1.2.141",
"@swc/jest": "0.2.20",
"@timsuchanek/copy": "1.4.5",
"@types/debug": "4.1.7",
"@types/jest": "27.5.0",
"@types/js-levenshtein": "1.1.1",
"@types/mssql": "7.1.5",
"@types/node": "12.20.50",
"@types/pg": "8.6.5",
"arg": "5.0.1",
"benchmark": "2.1.4",
"chalk": "4.1.2",
"decimal.js": "10.3.1",
"esbuild": "0.13.14",
"execa": "5.1.1",
"flat-map-polyfill": "0.3.8",
"fs-extra": "10.0.0",
"fs-monkey": "1.0.3",
"get-own-enumerable-property-symbols": "3.0.2",
"globby": "11.1.0",
"indent-string": "4.0.0",
"is-obj": "2.0.0",
"is-regexp": "2.1.0",
"jest": "28.1.0",
"jest-junit": "13.2.0",
"js-levenshtein": "1.1.6",
"klona": "2.0.5",
"lz-string": "1.4.4",
"make-dir": "3.1.0",
"mariadb": "3.0.0",
"mssql": "8.0.1",
"pg": "8.7.1",
"pkg-up": "3.1.0",
"pluralize": "8.0.0",
"replace-string": "3.1.0",
"resolve": "1.22.0",
"rimraf": "3.0.2",
"sort-keys": "4.2.0",
"source-map-support": "0.5.21",
"sql-template-tag": "4.0.0",
"stacktrace-parser": "0.1.10",
"strip-ansi": "6.0.1",
"strip-indent": "3.0.0",
"ts-jest": "28.0.2",
"ts-node": "10.4.0",
"tsd": "0.19.1",
"typescript": "4.5.4"
},
"peerDependencies": {
"prisma": "*"
},
"peerDependenciesMeta": {
"prisma": {
"optional": true
}
},
"dependencies": {
"@prisma/engines-version": "3.14.0-36.2b0c12756921c891fec4f68d9444e18c7d5d4a6a"
},
"sideEffects": false,
"scripts": {
"dev": "DEV=true node -r esbuild-register helpers/build.ts",
"build": "node -r esbuild-register helpers/build.ts",
"test": "jest --verbose",
"test:functional": "pnpm run test:functional:code && pnpm run test:functional:types",
"test:functional:code": "jest --verbose --config=tests/functional/jest.config.js --testPathIgnorePatterns typescript --",
"test:functional:types": "jest --verbose --config=tests/functional/jest.config.js -- typescript",
"test-notypes": "jest --verbose --testPathIgnorePatterns src/__tests__/types/types.test.ts",
"generate": "node scripts/postinstall.js",
"postinstall": "node scripts/postinstall.js"
},
"readme": "# Prisma Client · [](https://www.npmjs.com/package/@prisma/client) [](https://github.com/prisma/prisma/blob/main/CONTRIBUTING.md) [](https://github.com/prisma/prisma/blob/main/LICENSE) [](https://slack.prisma.io/)\n\nPrisma Client JS is an **auto-generated query builder** that enables **type-safe** database access and **reduces boilerplate**. You can use it as an alternative to traditional ORMs such as Sequelize, TypeORM or SQL query builders like knex.js.\n\nIt is part of the [Prisma](https://www.prisma.io/) ecosystem. Prisma provides database tools for data access, declarative data modeling, schema migrations and visual data management. Learn more in the main [`prisma`](https://github.com/prisma/prisma/) repository or read the [documentation](https://www.prisma.io/docs/).\n\n## Getting started\n\nFollow one of these guides to get started with Prisma Client JS:\n\n- [Quickstart](https://www.prisma.io/docs/getting-started/quickstart) (5 min)\n- [Set up a new project with Prisma (SQL migrations)](https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch-sql) (15 min)\n- [Set up a new project with Prisma (Prisma Migrate)](https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch-prisma-migrate) (15 min)\n- [Add Prisma to an existing project](https://www.prisma.io/docs/getting-started/setup-prisma/add-to-existing-project) (15 min)\n\nAlternatively you can explore the ready-to-run [examples](https://github.com/prisma/prisma-examples/) (REST, GraphQL, gRPC, plain JavaScript and TypeScript demos, ...) or watch the [demo videos](https://www.youtube.com/watch?v=0RhtQgIs-TE&list=PLn2e1F9Rfr6k9PnR_figWOcSHgc_erDr5&index=1) (1-2 min per video).\n\n## Contributing\n\nRefer to our [contribution guidelines](https://github.com/prisma/prisma/blob/main/CONTRIBUTING.md) and [Code of Conduct for contributors](https://github.com/prisma/prisma/blob/main/CODE_OF_CONDUCT.md).\n\n## Build Status\n\n- Prisma Tests Status: \n [](https://buildkite.com/prisma/prisma2-test)\n- Ecosystem Tests Status: \n [](https://github.com/prisma/ecosystem-tests/actions)\n"
}
and for version 13.15.2
{
"name": ".prisma/client",
"main": "index.js",
"types": "index.d.ts",
"browser": "index-browser.js"
}

How to reproduce
- Install prisma 3.15.2 with pnpm $ pnpm add @prisma/client@3.15.2
- Try to add another package (doesn’t matter which package, using is-even as example) $ pnpm add is-even
- See error
Expected behavior
After upgrading prisma, I should be able to install new packages.
Prisma information
generator client {
provider = "prisma-client-js"
output = "../../../../node_modules/@prisma/client"
binaryTargets = ["native", "darwin", "linux-musl"]
}
generator typegraphql {
provider = "typegraphql-prisma"
output = "./generated/type-graphql"
emitOnly = "models,enums,relationResolvers"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
Environment & setup
- OS: Mac OS
- Database: PostgreSQL
- Node.js version: v16.15.1
Prisma Version
prisma : 3.15.2
@prisma/client : 3.15.2
Current platform : darwin
Query Engine (Node-API) : libquery-engine 461d6a05159055555eb7dfb337c9fb271cbd4d7e (at node_modules/.pnpm/@prisma+engines@3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e/node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine : migration-engine-cli 461d6a05159055555eb7dfb337c9fb271cbd4d7e (at node_modules/.pnpm/@prisma+engines@3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e/node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 461d6a05159055555eb7dfb337c9fb271cbd4d7e (at node_modules/.pnpm/@prisma+engines@3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e/node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary : prisma-fmt 461d6a05159055555eb7dfb337c9fb271cbd4d7e (at node_modules/.pnpm/@prisma+engines@3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e/node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash : 461d6a05159055555eb7dfb337c9fb271cbd4d7e
Studio : 0.462.0
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 22 (7 by maintainers)
Commits related to this issue
- fix: Use valid package name in package.json and prevent publishing In 3.16 we started generating `package.json` independently of output location. Turns out some users pnpm/yarn glob patterns match th... — committed to prisma/prisma by SevInf 2 years ago
- fix: Use valid package name in package.json and prevent publishing In 3.16 we started generating `package.json` independently of output location. Turns out some users pnpm/yarn glob patterns match th... — committed to prisma/prisma by SevInf 2 years ago
- fix(client): error on attempt to generate a package in main client directory Overriding this directory might lead to all kinds of problems. This never supposed to work in the first place and it's alr... — committed to prisma/prisma by SevInf 2 years ago
- fix(client): error on attempt to generate a package in main client directory Overriding this directory might lead to all kinds of problems. This never supposed to work in the first place and it's alr... — committed to prisma/prisma by SevInf 2 years ago
- fix(client): error on attempt to generate a package in main client directory Overriding this directory might lead to all kinds of problems. This never supposed to work in the first place and it's alr... — committed to prisma/prisma by SevInf 2 years ago
- fix(client): error on attempt to generate a package in main client directory (#14361) Overriding this directory might lead to all kinds of problems. This never supposed to work in the first place an... — committed to prisma/prisma by SevInf 2 years ago
I don’t understand how this is closed. The suggested solution is to go edit a generated package.json file which is a no go for many reasons. Shouldn’t prisma not generate a client with an invalid name to begin with?
I’m solved by
output = "../node_modules/.prisma/client
The same issue here with pnpm v7.5
My config for prisma
What I got when run
pnpm install
Workaround
Open the package.json, replace
.prisma/client
with@prisma/client
, solved, but when I add new new deps, I should edit this file again, I am waiting for an official solution here too.I am having issue with this while deploying to firebase
Open a bug report issue please and describe the full problem you are experiencing in a way we can reproduce this. With no bug report, we are not aware of any problem and can not give any advice how to prevent that. Thanks.
The user closed the issue themselves, as the suggested solution (which was not to edit the package.json) seems to have solved their problem: https://github.com/prisma/prisma/issues/13893#issuecomment-1188653768
@Satont while we will fix the issue regardless, please also note that using
output = "../node_modules/@prisma/client"
is not the best idea, please useoutput = "../node_modules/.prisma/client"
instead (and reinstall the dependencies to restore the state of@prisma/client
package). The defaultindex.js
andindex.d.ts
files in@prisma/client
re-export everything from.prisma/client
, which is the default location for the generated client.