llamacoder icon indicating copy to clipboard operation
llamacoder copied to clipboard

npm run dev error

Open mxlik-ali opened this issue 1 year ago • 13 comments

i installed all the prerequisite like node js but whem i run npm run dev it gives this error

Error: ErrorEvent at resolveErrorDev (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js:1792:63) at processFullStringRow (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js:2071:17) at processFullBinaryRow (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js:2059:7) at progress (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js:2262:17)

mxlik-ali avatar Feb 06 '25 13:02 mxlik-ali

Image

mxlik-ali avatar Feb 06 '25 14:02 mxlik-ali

node version v18.20.6 npm version v10.8.2 Next.js 15.1.6 i tries installing through node v 22LTS but still im facing the same issue cant figure this out help me if possible

mxlik-ali avatar Feb 06 '25 14:02 mxlik-ali

node version v18.20.6 npm version v10.8.2 Next.js 15.1.6 i tries installing through node v 22LTS but still im facing the same issue cant figure this out help me if possible

if your database url in .env is localhost,make sure disable prisma adaper in prisam.ts and schema.prisma like this

// schema.prisma
generator client {
  provider        = "prisma-client-js"
 //  previewFeatures = ["driverAdapters"]
}
// prisam.ts
export const getPrisma = cache(() => {
  // const neon = new Pool({ connectionString: process.env.DATABASE_URL });
  // const adapter = new PrismaNeon(neon);
  //return new PrismaClient({ adapter });
  return new PrismaClient();

});

annilq avatar Feb 08 '25 03:02 annilq

by following @annilq , i have explored how to fix the problem

i imported edge client normal

import { PrismaClient } from "@prisma/client/edge";

instead of this

import { PrismaClient } from "@prisma/client";

i added DATABASE_URL variable for using my prisma client

npx prisma migrate dev --name init

ran this code to create prisma client

Removed the adapter from the prisma client

  const prisma = new PrismaClient({  });


This fixed the issue of the above

Thanks @annilq for help

nickthelegend avatar Feb 08 '25 08:02 nickthelegend

by following @annilq , i have explored how to fix the problem

i imported edge client normal

import { PrismaClient } from "@prisma/client/edge"; instead of this

import { PrismaClient } from "@prisma/client"; i added DATABASE_URL variable for using my prisma client

npx prisma migrate dev --name init ran this code to create prisma client

Removed the adapter from the prisma client

const prisma = new PrismaClient({ }); This fixed the issue of the above

Thanks @annilq for help

我用了你的方法但是没有解决问题,请教一下你是怎么设置的。

jacksonSuu avatar Feb 15 '25 10:02 jacksonSuu

by following @annilq , i have explored how to fix the problem

i imported edge client normal

import { PrismaClient } from "@prisma/client/edge"; instead of this

import { PrismaClient } from "@prisma/client"; i added DATABASE_URL variable for using my prisma client

npx prisma migrate dev --name init ran this code to create prisma client

Removed the adapter from the prisma client

const prisma = new PrismaClient({ }); This fixed the issue of the above

Thanks @annilq for help

我用了你的方法但是没有解决问题,请教一下你是怎么设置的。

在确认取消了适配器后也要执行数据库初始化操作,npx prisma genetate,npx prisma db push 等,你可以看看其他相关issue

annilq avatar Feb 15 '25 15:02 annilq

by following @annilq , i have explored how to fix the problem i imported edge client normal import { PrismaClient } from "@prisma/client/edge"; instead of this import { PrismaClient } from "@prisma/client"; i added DATABASE_URL variable for using my prisma client npx prisma migrate dev --name init ran this code to create prisma client Removed the adapter from the prisma client const prisma = new PrismaClient({ }); This fixed the issue of the above Thanks @annilq for help

我用了你的方法但是没有解决问题,请教一下你是怎么设置的。

are you still facing the same issue?

nickthelegend avatar Feb 15 '25 16:02 nickthelegend

by following @annilq , i have explored how to fix the problem i imported edge client normal import { PrismaClient } from "@prisma/client/edge"; instead of this import { PrismaClient } from "@prisma/client"; i added DATABASE_URL variable for using my prisma client npx prisma migrate dev --name init ran this code to create prisma client Removed the adapter from the prisma client const prisma = new PrismaClient({ }); This fixed the issue of the above Thanks @annilq for help

我用了你的方法但是没有解决问题,请教一下你是怎么设置的。

are you still facing the same issue?

Here's what I'm reporting as an error: Image

config and code:

#.env
DATABASE_URL="postgresql://postgres:123456@localhost:3718/together"
#lib\prisma.ts
import { PrismaClient } from "@prisma/client/edge";
import { PrismaNeon } from "@prisma/adapter-neon";
import { Pool } from "@neondatabase/serverless";
import { cache } from "react";

export const getPrisma = cache(() => {
  const neon = new Pool({ connectionString: process.env.DATABASE_URL });
  const adapter = new PrismaNeon(neon);
  return new PrismaClient({  });
});
#prisma\schema.prisma
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["driverAdapters"]
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

jacksonSuu avatar Feb 17 '25 08:02 jacksonSuu

把neon和adapter注释掉

annilq avatar Feb 17 '25 10:02 annilq

把neon和adapter注释掉

不行。现在是这样的报错 error:

Image

#lib\prisma.ts
import { PrismaClient } from "@prisma/client";
import { PrismaNeon } from "@prisma/adapter-neon";
import { Pool } from "@neondatabase/serverless";
import { cache } from "react";

export const getPrisma = cache(() => {
  // const neon = new Pool({ connectionString: process.env.DATABASE_URL });
  // const adapter = new PrismaNeon(neon);
  return new PrismaClient();
});
#prisma\schema.prisma
generator client {
  provider        = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

jacksonSuu avatar Feb 17 '25 10:02 jacksonSuu

把page页面的runtine=edge注释掉试试

annilq avatar Feb 17 '25 11:02 annilq

把page页面的runtine=edge注释掉试试

正常运行了!非常感谢。

jacksonSuu avatar Feb 18 '25 01:02 jacksonSuu

Image

[ Server ] Error: PrismaClient is not configured to run in Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware). In order to run Prisma Client on edge runtime, either:

  • Use Prisma Accelerate: https://pris.ly/d/accelerate
  • Use Driver Adapters: https://pris.ly/d/driver-adapters

If this is unexpected, please open an issue: https://pris.ly/prisma-prisma-bug-report

help me pls

ferasfm avatar May 06 '25 19:05 ferasfm

solved this due to prisma version issue

riccardogiorato avatar Aug 26 '25 16:08 riccardogiorato