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.

I get "Can't resolve '_http_common'" when I use NestJS with monorepo (webpack)

See original GitHub issue

Bug description

When I try to composite Prisma with NestJS monorepo project I get the error. I can`t use default prisma client output path because my projects use prisma client and each project overrides before generated client files. I try to use custom output path but I get the error. I found some information about the error -> https://github.com/restify/node-restify/issues/794.

How to reproduce

Steps to reproduce the behavior:

  1. Create new app as monorepo project
  2. Generate client in custom output path. For example “output = …/src/prisma/client”
  3. Execute command “build”
  4. See error “Can’t resolve ‘_http_common’”

Expected behavior

Build happy project

Environment & setup

  • OS: Mac OS
  • Database: PostgreSQL
  • Node.js version: 12.22.1
  • Prisma version: 2.21.2
datasource db {
  provider	=	"postgresql"
  url	=	env("MAIN_DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
  output = "../src/prisma/client"
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:31 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
homokycommented, Mar 3, 2022

For me is working to get client generated as below:

generator client {
  provider        = "prisma-client-js"
  output          = "../../../node_modules/@~internal/prisma"
}

Then you can import it from anywhere like:

import {PrismaClient} from '@~internal/prisma'

Hope it helps.

3reactions
LayneHabercommented, Jun 8, 2021

Also sad to report that I didn’t find a workaround other than not upgrading prisma or webpack 😢

But it does look like v4 of unidici is in release candidate stages

Read more comments on GitHub >

github_iconTop Results From Across the Web

Monorepo - CLI | NestJS - A progressive Node.js framework
It automates parts of the build process to make it easy to create and compose modular components, promotes code re-use, makes integration testing...
Read more >
Nestjs: Repl with monorepo mode - Stack Overflow
Looking at my dist folder, the only build target is main.js , which would explain it not being able to find the repl...
Read more >
Webpack - Serverless Framework: Plugins
A Serverless Framework plugin to build your lambda functions with Webpack. This plugin is for you if you want to use the latest...
Read more >
Documentation | NestJS - A progressive Node.js framework
Monorepo's have arisen as a construct to enable that, and within a monorepo, a library provides a way to share code in an...
Read more >
API with NestJS #59. Introduction to a monorepo with Lerna ...
This article uses Lerna and Yarn workspaces to manage a monorepo ... and ESlint configuration that we will use in every project we...
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