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.

`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

See original GitHub issue
  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?)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

10reactions
janpiocommented, Apr 4, 2021

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

1reaction
narenarjuncommented, Apr 24, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

typeerror [err_invalid_arg_type]: the "file" argument must be of ...
The error message means that a method of the path module (like path.join ) expects one of its arguments to be a string...
Read more >
The "path" argument must be of type string ... - Stack Overflow
I'm working on a project in React and ran into a problem that has me stumped. Whenever I run yarn start I get...
Read more >
How To Fix Sfdx Error: The "Path" Argument Must Be Of Type ...
TypeError [ERRINVALIDARGTYPE]: The path argument must be of type string. Received an instance of Object when old @prisma/client in parent folder #6372.
Read more >
The "path" argument must be of type string. Received - YouTube
JavaScript : TypeError [ERR_INVALID_ARG_TYPE]: The " path " argument must be of type string. Received type undefined raised when starting ...
Read more >
Is Prisma an ORM?
Traditional ORMs provide an object-oriented way for working with ... use Prisma Client to read and write data in your database in a...
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