Skip to content

Conversation

bizob2828
Copy link
Member

Description

I noticed nestjs versioned tests started failing on an older version 10.4.9:

Error: Command failed: npx nest build
  src/app.controller.ts:1:38 - error TS2307: Cannot find module '@nestjs/common' or its corresponding type declarations.

  1 import { Controller, Get, Req } from '@nestjs/common';
                                         ~~~~~~~~~~~~~~~~
  src/app.module.ts:1:24 - error TS2307: Cannot find module '@nestjs/common' or its corresponding type declarations.

  1 import { Module } from '@nestjs/common';
                           ~~~~~~~~~~~~~~~~
  src/app.service.ts:1:28 - error TS2307: Cannot find module '@nestjs/common' or its corresponding type declarations.

  1 import { Injectable } from '@nestjs/common';
                               ~~~~~~~~~~~~~~~~
  src/main.ts:1:29 - error TS2307: Cannot find module '@nestjs/core' or its corresponding type declarations.

  1 import { NestFactory } from '@nestjs/core';
                                ~~~~~~~~~~~~~~


      at genericNodeError (node:internal/errors:983:15)
      at wrappedFn (node:internal/errors:537:14)
      at ChildProcess.exithandler (node:child_process:415:12)
      at ChildProcess.emit (node:events:507:28)
      at maybeClose (node:internal/child_process:1101:16)
      at Socket.<anonymous> (node:internal/child_process:457:11)
      at Socket.emit (node:events:507:28)
      at Pipe.<anonymous> (node:net:346:12) {
    code: 1,
    killed: false,
    signal: null,
    cmd: 'npx nest build',
    stdout: 'Found 4 error(s).\n\n',
    stderr: "\x1B[96msrc/app.controller.ts\x1B[0m:\x1B[93m1\x1B[0m:\x1B[93m38\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module '@nestjs/common' or its corresponding type declarations.\n\n\x1B[7m1\x1B[0m import { Controller, Get, Req } from '@nestjs/common';\n\x1B[7m \x1B[0m \x1B[91m                                     ~~~~~~~~~~~~~~~~\x1B[0m\n\x1B[96msrc/app.module.ts\x1B[0m:\x1B[93m1\x1B[0m:\x1B[93m24\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module '@nestjs/common' or its corresponding type declarations.\n\n\x1B[7m1\x1B[0m import { Module } from '@nestjs/common';\n\x1B[7m \x1B[0m \x1B[91m                       ~~~~~~~~~~~~~~~~\x1B[0m\n\x1B[96msrc/app.service.ts\x1B[0m:\x1B[93m1\x1B[0m:\x1B[93m28\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module '@nestjs/common' or its corresponding type declarations.\n\n\x1B[7m1\x1B[0m import { Injectable } from '@nestjs/common';\n\x1B[7m \x1B[0m \x1B[91m                           ~~~~~~~~~~~~~~~~\x1B[0m\n\x1B[96msrc/main.ts\x1B[0m:\x1B[93m1\x1B[0m:\x1B[93m29\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module '@nestjs/core' or its corresponding type declarations.\n\n\x1B[7m1\x1B[0m import { NestFactory } from '@nestjs/core';\n\x1B[7m \x1B[0m \x1B[91m                            ~~~~~~~~~~~~~~\x1B[0m\n\n"
  }

Digging more into it, it was because of an peer dep conflict:

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/typescript
npm error   dev typescript@"^5.1.3" from the root project
npm error   peer typescript@">=4.8.2" from @nestjs/[email protected]
npm error   node_modules/@nestjs/schematics
npm error     dev @nestjs/schematics@"^10.0.0" from the root project
npm error     @nestjs/schematics@"^10.0.1" from @nestjs/[email protected]
npm error     node_modules/@nestjs/cli
npm error       dev @nestjs/cli@"^10.0.0" from the root project
npm error
npm error Could not resolve dependency:
npm error dev @typescript-eslint/eslint-plugin@"^8.0.0" from the root project
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/typescript
npm error   peer typescript@">=4.8.4 <5.9.0" from @typescript-eslint/[email protected]
npm error   node_modules/@typescript-eslint/eslint-plugin
npm error     dev @typescript-eslint/eslint-plugin@"^8.0.0" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error

This PR updates the setup of test-app by skipping install in nest cli and running npm install manually and forcing peer dep resolution

@bizob2828 bizob2828 added the dev:tests Indicates only changes to tests label Jul 31, 2025
@mrickard mrickard self-assigned this Jul 31, 2025
Copy link

codecov bot commented Jul 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.61%. Comparing base (c7fd60e) to head (f00baa9).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3269      +/-   ##
==========================================
- Coverage   97.66%   97.61%   -0.05%     
==========================================
  Files         345      345              
  Lines       51757    51757              
==========================================
- Hits        50549    50524      -25     
- Misses       1208     1233      +25     
Flag Coverage Δ
integration-tests-cjs-20.x 73.92% <ø> (ø)
integration-tests-cjs-22.x 73.96% <ø> (ø)
integration-tests-cjs-24.x 74.70% <ø> (ø)
integration-tests-esm-20.x 49.46% <ø> (ø)
integration-tests-esm-22.x 49.53% <ø> (ø)
integration-tests-esm-24.x 51.23% <ø> (ø)
unit-tests-20.x 88.31% <ø> (ø)
unit-tests-22.x 88.32% <ø> (ø)
unit-tests-24.x 88.33% <ø> (ø)
versioned-tests-20.x 80.24% <ø> (-0.18%) ⬇️
versioned-tests-22.x 80.25% <ø> (-0.18%) ⬇️
versioned-tests-24.x 80.14% <ø> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bizob2828 bizob2828 merged commit 4e454ff into newrelic:main Jul 31, 2025
29 of 30 checks passed
@bizob2828 bizob2828 deleted the fix-nest-10x-issues branch July 31, 2025 19:21
@github-project-automation github-project-automation bot moved this from Needs PR Review to Done: Issues recently completed in Node.js Engineering Board Jul 31, 2025
@github-actions github-actions bot mentioned this pull request Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev:tests Indicates only changes to tests
Projects
Status: Done: Issues recently completed
Development

Successfully merging this pull request may close these issues.

2 participants