question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

 ERR_PNPM_BAD_PACKAGE_JSON : Invalid name: ".prisma/client"

See original GitHub issue

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 &middot; [![npm version](https://img.shields.io/npm/v/@prisma/client.svg?style=flat)](https://www.npmjs.com/package/@prisma/client) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/prisma/prisma/blob/main/CONTRIBUTING.md) [![GitHub license](https://img.shields.io/badge/license-Apache%202-blue)](https://github.com/prisma/prisma/blob/main/LICENSE) [![Slack](https://img.shields.io/badge/chat-on%20slack-blue.svg)](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  [![Build status](https://badge.buildkite.com/590e1981074b70961362481ad8319a831b44a38c5d468d6408.svg?branch=master)](https://buildkite.com/prisma/prisma2-test)\n- Ecosystem Tests Status:  \n  [![Actions Status](https://github.com/prisma/ecosystem-tests/workflows/test/badge.svg)](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"
}
Screen Shot 2022-06-18 at 7 46 27 PM

How to reproduce

  1. Install prisma 3.15.2 with pnpm $ pnpm add @prisma/client@3.15.2
  2. Try to add another package (doesn’t matter which package, using is-even as example) $ pnpm add is-even
  3. See error Screen Shot 2022-06-18 at 8 15 04 PM

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Satontcommented, Jul 13, 2022

The same issue here with pnpm v7.5

My config for prisma

generator client {
  provider        = "prisma-client-js"
  binaryTargets   = ["native", "debian-openssl-1.1.x"]
  output          = "../node_modules/@prisma/client"
  previewFeatures = ["fullTextIndex", "fullTextSearch", "interactiveTransactions"]
}

What I got when run pnpm install

 ERR_PNPM_BAD_PACKAGE_JSON  /root/ritchie/services/node_modules/@prisma/client/package.json: Invalid name: ".prisma/client"

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.

vim /root/ritchie/services/node_modules/@prisma/client/package.json

{
  "name": ".prisma/client",  # change this to "@prisma/client"
  "main": "index.js",
  "types": "index.d.ts",
  "browser": "index-browser.js"
}

I’m solved by output = "../node_modules/.prisma/client

0reactions
laozhucommented, Jul 29, 2022

HI @aqrln I am using turborepo with pnpm in my several monorepo projects, every project have the problem with lastest prisma client. I have not figured out what’s the problem is, but if I add output field in prisma.schema, the problem will be solved. I think this a bug import from recent release, because months ago there’s no this problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Invalid name in Prisma of node.js project - Stack Overflow
Based on npm Docs. The "name" field contains your package's name, and must be lowercase and one word, and may contain hyphens and ......
Read more >
Error Codes | pnpm
This might happen in a CI environment if someone has changed a package.json file in the repository without running pnpm install afterwards.
Read more >
pnpm/pnpm - Gitter
so it would install lodash to all 4 package.json? ... Has anyone had problems when running pnpm install - ERROR: Invalid tag name...
Read more >
Managing a full-stack, multipackage monorepo using pnpm
Learn why pnpm performs better than npm and how the many special ... Now, change into that directory and create the package.json file...
Read more >
npmrc | pnpm中文文档
This setting controls how dependencies that are linked from the workspace are added to package.json . If foo@1.0.0 is in the workspace and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found