prisma: `TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Object` when old `@prisma/client` in parent folder

  1. new folder
  2. npm init -y
  3. npm install prisma
  4. npx prisma init
  5. adapt schema file:
datasource db {
  provider = "sqlite"
  url      = "file:./dev.db"
}

generator client {
  provider = "prisma-client-js"
}

model User {
  id        Int       @id @default(autoincrement())
  name      String
}
  1. npx prisma db push --preview-feature
  2. db push works, but then generation fails with:
C:\Users\Jan\Documents\throwaway\pathtypestring  (pathtypestring@1.0.0)
λ npx prisma db push --preview-feature
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": SQLite database "dev.db" at "file:./dev.db"

SQLite database dev.db created at file:./dev.db


Your database is now in sync with your schema. Done in 57ms

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Object
    at new NodeError (node:internal/errors:329:5)
    at validateString (node:internal/validators:129:11)
    at Object.join (node:path:397:7)
    at getDotPrismaDir (C:\Users\Jan\Documents\throwaway\node_modules\@prisma\client\generator-build\index.js:72820:33)
    at Object.generateClient (C:\Users\Jan\Documents\throwaway\node_modules\@prisma\client\generator-build\index.js:72842:49)
    at Object.onGenerate (C:\Users\Jan\Documents\throwaway\node_modules\@prisma\client\generator-build\index.js:78035:34)
    at LineStream.<anonymous> (C:\Users\Jan\Documents\throwaway\node_modules\@prisma\client\generator-build\index.js:2802:40)
    at LineStream.emit (node:events:369:20)
    at addChunk (node:internal/streams/readable:313:12)
    at readableAddChunk (node:internal/streams/readable:288:9)

C:\Users\Jan\Documents\throwaway\pathtypestring  (pathtypestring@1.0.0) 
λ cat package.json                                                      
{                                                                       
  "name": "pathtypestring",                                             
  "version": "1.0.0",                                                   
  "description": "",                                                    
  "main": "index.js",                                                   
  "scripts": {                                                          
    "test": "echo \"Error: no test specified\" && exit 1"               
  },                                                                    
  "keywords": [],                                                       
  "author": "",                                                         
  "license": "ISC",                                                     
  "dependencies": {                                                     
    "prisma": "^2.20.1"                                                 
  }                                                                     
}                                                                       

C:\Users\Jan\Documents\throwaway\pathtypestring  (pathtypestring@1.0.0)
λ npx prisma -v
Environment variables loaded from .env
prisma               : 2.20.1
@prisma/client       : 2.15.0-dev.73
Current platform     : windows
Query Engine         : query-engine 60ba6551f29b17d7d6ce479e5733c70d9c00860e (at node_modules\@prisma\engines\query-engine-windows.exe)
Migration Engine     : migration-engine-cli 60ba6551f29b17d7d6ce479e5733c70d9c00860e (at node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine : introspection-core 60ba6551f29b17d7d6ce479e5733c70d9c00860e (at node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary        : prisma-fmt 60ba6551f29b17d7d6ce479e5733c70d9c00860e (at node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash : 60ba6551f29b17d7d6ce479e5733c70d9c00860e
Studio               : 0.365.0

⚠️ Note how this lists @prisma/client : 2.15.0-dev.73. Turns out there was a package.json in a parent folder with this old @prisma/client version.

Expectation would be to at least get a warning about this incompatible version.

(I assume that using this dependency from the parent folder is “normal” in Node?)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

The solution is to update both CLI and Client to the same version.

Update your @prisma/client to the same version as your prisma CLI dependency @narenarjun.

i have "@prisma/client": "^2.8.1" and "prisma": "^2.21.2", in the respective versions, so do i bump up @prisma/client to 2.21.2 or bring prisma to 2.8.1 ??

updated @prisma/client to 2.21.2 and the command yarn prisma generate didn’t throw any error 👍👍 thanks @janpio

i have "@prisma/client": "^2.8.1" and "prisma": "^2.21.2", in the respective versions, so do i bump up @prisma/client to 2.21.2 or bring prisma to 2.8.1 ??