Generate command not working

[email protected] db:generate C:...\gitrepos\repo prisma generate
Environment variables loaded from .env Prisma schema loaded from prisma\schema.prisma Error: Unexpected end of JSON input Any solutions welcome, The DEBUG env var does nothing
Solution:
Solved, it did not like my output folder
Jump to solution
3 Replies
Prisma AI Help
Prisma AI Helpā€¢3d ago
Skipping coffee for instant knowledge! Let's brew that AI answer now. I can see you're encountering an "Unexpected end of JSON input" error when running prisma generate. This is a known issue that can occur for several reasons. Based on the knowledge sources, here are some potential solutions: Possible causes and solutions: 1. Node.js version incompatibility
This error is known to occur with specific Node.js versions, particularly with Node 16.17.0 and Prisma 2.x. Several users reported this issue in GitHub issue #14834 and GitHub issue #15193. Solutions: - Downgrade Node.js to version 16.16.0 or earlier - Upgrade to Node.js 17.x - Enable the napi preview feature in your schema.prisma file:
generator client {
provider = "prisma-client-js"
previewFeatures = ["napi"]
}

generator client {
provider = "prisma-client-js"
previewFeatures = ["napi"]
}

2. Incompatible Prisma versions Make sure your Prisma CLI and Prisma Client versions match. As mentioned in GitHub issue #19130, reinstalling Prisma can help:
npm remove prisma @prisma/client
npm install prisma @prisma/client

npm remove prisma @prisma/client
npm install prisma @prisma/client

3. Path issues on Windows If you're using Windows, there might be issues with paths containing spaces or special characters as seen in GitHub issue #1973. Try: - Moving your project to a path without spaces - Using require.resolve instead of the default resolver (this would require modifying Prisma's code) 4. Large schema files If your schema is very large (100+ tables), this could cause the error as documented in GitHub issue #8525. In this case: - Try increasing available RAM - Consider splitting your schema into smaller parts if possible 5. Upgrading Prisma If you're using an older version of Prisma, upgrading to the latest version might resolve the issue as mentioned by users in GitHub issue #14834. If none of these solutions work, please provide more information about your environment (Node.js version, Prisma version, OS) and the content of your schema.prisma file for more specific help. šŸ¤” Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
lonelyplanet
lonelyplanetOPā€¢3d ago
PS C:...\gitrepos\repo> pnpm prisma debug
Environment variables loaded from .env
-- Prisma schema --
Path: C:...\gitrepos\repo\prisma\schema.prisma

-- Local cache directory for engines files --
Path: C:...\gitrepos\repo\node_modules\.cache\prisma

-- Environment variables --
When not set, the line is dimmed and no value is displayed.
When set, the line is bold and the value is inside the `` backticks.

For general debugging
- CI:
- DEBUG: `*`
- NODE_ENV:
- RUST_LOG:
- RUST_BACKTRACE:
- NO_COLOR:
- TERM:
- NODE_TLS_REJECT_UNAUTHORIZED:
- NO_PROXY:
- http_proxy:
- HTTP_PROXY:
- https_proxy:
- HTTPS_PROXY:

For more information about Prisma environment variables:
See https://www.prisma.io/docs/reference/api-reference/environment-variables-reference

For hiding messages
- PRISMA_DISABLE_WARNINGS:
- PRISMA_HIDE_PREVIEW_FLAG_WARNINGS:
- PRISMA_HIDE_UPDATE_MESSAGE:

For downloading engines
- PRISMA_ENGINES_MIRROR:
- PRISMA_BINARIES_MIRROR (deprecated):
- PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING:
- BINARY_DOWNLOAD_VERSION:

For configuring the Query Engine Type
- PRISMA_CLI_QUERY_ENGINE_TYPE:
- PRISMA_CLIENT_ENGINE_TYPE:

For custom engines
- PRISMA_QUERY_ENGINE_BINARY:
- PRISMA_QUERY_ENGINE_LIBRARY:
- PRISMA_SCHEMA_ENGINE_BINARY:
- PRISMA_MIGRATION_ENGINE_BINARY:

For the "postinstall" npm hook
- PRISMA_GENERATE_SKIP_AUTOINSTALL:
- PRISMA_SKIP_POSTINSTALL_GENERATE:
- PRISMA_GENERATE_IN_POSTINSTALL:

For "prisma generate"
- PRISMA_GENERATE_DATAPROXY:
- PRISMA_GENERATE_NO_ENGINE:

For Prisma Client
- PRISMA_SHOW_ALL_TRACES:
- PRISMA_CLIENT_NO_RETRY (Binary engine only):

For Prisma Migrate
- PRISMA_SCHEMA_DISABLE_ADVISORY_LOCK:
- PRISMA_MIGRATE_SKIP_GENERATE:
- PRISMA_MIGRATE_SKIP_SEED:

For Prisma Studio
- BROWSER:

-- Terminal is interactive? --
true

-- CI detected? --
false
PS C:...\gitrepos\repo> pnpm prisma debug
Environment variables loaded from .env
-- Prisma schema --
Path: C:...\gitrepos\repo\prisma\schema.prisma

-- Local cache directory for engines files --
Path: C:...\gitrepos\repo\node_modules\.cache\prisma

-- Environment variables --
When not set, the line is dimmed and no value is displayed.
When set, the line is bold and the value is inside the `` backticks.

For general debugging
- CI:
- DEBUG: `*`
- NODE_ENV:
- RUST_LOG:
- RUST_BACKTRACE:
- NO_COLOR:
- TERM:
- NODE_TLS_REJECT_UNAUTHORIZED:
- NO_PROXY:
- http_proxy:
- HTTP_PROXY:
- https_proxy:
- HTTPS_PROXY:

For more information about Prisma environment variables:
See https://www.prisma.io/docs/reference/api-reference/environment-variables-reference

For hiding messages
- PRISMA_DISABLE_WARNINGS:
- PRISMA_HIDE_PREVIEW_FLAG_WARNINGS:
- PRISMA_HIDE_UPDATE_MESSAGE:

For downloading engines
- PRISMA_ENGINES_MIRROR:
- PRISMA_BINARIES_MIRROR (deprecated):
- PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING:
- BINARY_DOWNLOAD_VERSION:

For configuring the Query Engine Type
- PRISMA_CLI_QUERY_ENGINE_TYPE:
- PRISMA_CLIENT_ENGINE_TYPE:

For custom engines
- PRISMA_QUERY_ENGINE_BINARY:
- PRISMA_QUERY_ENGINE_LIBRARY:
- PRISMA_SCHEMA_ENGINE_BINARY:
- PRISMA_MIGRATION_ENGINE_BINARY:

For the "postinstall" npm hook
- PRISMA_GENERATE_SKIP_AUTOINSTALL:
- PRISMA_SKIP_POSTINSTALL_GENERATE:
- PRISMA_GENERATE_IN_POSTINSTALL:

For "prisma generate"
- PRISMA_GENERATE_DATAPROXY:
- PRISMA_GENERATE_NO_ENGINE:

For Prisma Client
- PRISMA_SHOW_ALL_TRACES:
- PRISMA_CLIENT_NO_RETRY (Binary engine only):

For Prisma Migrate
- PRISMA_SCHEMA_DISABLE_ADVISORY_LOCK:
- PRISMA_MIGRATE_SKIP_GENERATE:
- PRISMA_MIGRATE_SKIP_SEED:

For Prisma Studio
- BROWSER:

-- Terminal is interactive? --
true

-- CI detected? --
false
Solution
lonelyplanet
lonelyplanetā€¢3d ago
Solved, it did not like my output folder

Did you find this page helpful?