Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: @nestjs/apollo and tslib (Yarn PnP + Workspaces) #2111

Closed
4 of 15 tasks
wataruian opened this issue Mar 28, 2022 · 1 comment
Closed
4 of 15 tasks

Error: @nestjs/apollo and tslib (Yarn PnP + Workspaces) #2111

wataruian opened this issue Mar 28, 2022 · 1 comment

Comments

@wataruian
Copy link

wataruian commented Mar 28, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Hi guys, I can't seem to start my nest application when using production build with Yarn PnP and @nestjs/apollo.

  1. Cannot start server when using start:prod.

  2. Can start server without problems using start:dev and omitting --production from yarn workspaces focus

Minimum reproduction code

https://github.com/wataruian/nestjs-apollo-tslib-repro-issue

Steps to reproduce

  1. Install all dependencies: yarn workspaces focus @my-project/my-app
  2. Build the dist files: yarn build
  3. Install dependencies (no devDeps): yarn workspaces focus @my-project/my-app --production
  4. Start the server: yarn start:prod

I already have tslib in dependencies at my workspace - packages.json and root - packages.json:
but nestjs/apollo still can't access the dependency.

Error thrown:
Error: @nestjs/apollo tried to access tslib, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Note: Issue does not occur in:

  1. Standalone PnP Mode (No workspace)
  2. Standard Workspaces (No PnP)
  3. Standard Mode (No Workspace, No PnP)

Issue only occurs when using Yarn Workspaces + PnP

Expected behavior

Should be able to start the application in start:prod

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

@nestjs/apollo

NestJS version

8.0.0

Packages versions

{
  "dependencies": {
    "@my-project/common": "workspace:*",
    "@nestjs/apollo": "10.0.5",
    "@nestjs/common": "^8.0.0",
    "@nestjs/core": "^8.0.0",
    "@nestjs/graphql": "10.0.5",
    "@nestjs/platform-express": "^8.0.0",
    "@prisma/client": "^3.9.2",
    "apollo-server-core": "3.6.3",
    "apollo-server-express": "3.6.3",
    "express": "4.17.3",
    "graphql": "16.3.0",
    "graphql-tools": "8.2.0",
    "pg": "^8.7.1",
    "prisma": "^3.9.2",
    "prisma-nestjs-graphql": "^14.6.1",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0",
    "tslib": "^2.3.1"
  },
  "devDependencies": {
    "@nestjs/cli": "^8.0.0",
    "@nestjs/schematics": "^8.0.0",
    "@nestjs/testing": "^8.0.0",
    "@types/express": "^4.17.13",
    "@types/jest": "27.4.0",
    "@types/node": "^16.0.0",
    "@types/supertest": "^2.0.11",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "@yarnpkg/pnpify": "^3.1.1-rc.15",
    "eslint": "^8.0.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "jest": "^27.2.5",
    "prettier": "^2.3.2",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "^27.0.3",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "^3.10.1",
    "typescript": "^4.3.5"
  }
}

Node.js version

16.14.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@kamilmysliwiec kamilmysliwiec transferred this issue from nestjs/nest Mar 29, 2022
@kamilmysliwiec
Copy link
Member

Error thrown:
Error: @nestjs/apollo tried to access tslib, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Are you using the latest version? See @nestjs/apollo package.json https://github.com/nestjs/graphql/blob/master/packages/apollo/package.json#L41

@nestjs nestjs locked and limited conversation to collaborators May 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants