Skip to content

GeneratePackgageJson missing package #26604

Open

Description

Current Behavior

Hello,
I´m using NX with NestJs and Angular.
Now My NestJS App using typeorm with mssql.
I want to create the packge json over my webpack config:

const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
const { join } = require('path');

module.exports = {
  output: {
    path: join(__dirname, '../../dist/apps/api'),
  },
  plugins: [
    new NxAppWebpackPlugin({
      target: 'node',
      compiler: 'tsc',
      main: './src/main.ts',
      tsConfig: './tsconfig.app.json',
      assets: ['./src/assets'],
      optimization: false,
      outputHashing: 'none',
      generatePackageJson: true,
    }),
  ],
};

here is my current package.json of my project:

{
  "name": "@material-requestment/source",
  "version": "1.0.0",
  "description": "TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nx run-many -t serve --all"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@angular/animations": "~18.0.0",
    "@angular/cdk": "^18.0.3",
    "@angular/common": "~18.0.0",
    "@angular/compiler": "~18.0.0",
    "@angular/core": "~18.0.0",
    "@angular/forms": "~18.0.0",
    "@angular/material": "^18.0.3",
    "@angular/platform-browser": "~18.0.0",
    "@angular/platform-browser-dynamic": "~18.0.0",
    "@angular/router": "~18.0.0",
    "@nestjs/common": "^10.0.2",
    "@nestjs/core": "^10.0.2",
    "@nestjs/mapped-types": "*",
    "@nestjs/platform-express": "^10.0.2",
    "@nestjs/serve-static": "^4.0.2",
    "@nestjs/swagger": "^7.3.1",
    "@nestjs/typeorm": "^10.0.2",
    "angular-svg-icon": "^17.0.0",
    "mssql": "^10.0.2",
    "nx": "^19.3.0",
    "reflect-metadata": "^0.1.13",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "typeorm": "^0.3.20",
    "zone.js": "~0.14.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~18.0.0",
    "@angular-devkit/core": "~18.0.0",
    "@angular-devkit/schematics": "~18.0.0",
    "@angular-eslint/eslint-plugin": "^18.0.1",
    "@angular-eslint/eslint-plugin-template": "^18.0.1",
    "@angular-eslint/template-parser": "^18.0.1",
    "@angular/cli": "~18.0.0",
    "@angular/compiler-cli": "~18.0.0",
    "@angular/language-service": "~18.0.0",
    "@nestjs/schematics": "^10.0.1",
    "@nestjs/testing": "^10.0.2",
    "@nx/angular": "19.3.0",
    "@nx/devkit": "19.3.0",
    "@nx/eslint": "19.3.0",
    "@nx/eslint-plugin": "19.3.0",
    "@nx/jest": "19.3.0",
    "@nx/js": "19.3.0",
    "@nx/nest": "19.3.0",
    "@nx/node": "19.3.0",
    "@nx/web": "19.3.0",
    "@nx/webpack": "19.3.0",
    "@schematics/angular": "~18.0.0",
    "@swc-node/register": "~1.9.1",
    "@swc/core": "~1.5.7",
    "@swc/helpers": "~0.5.11",
    "@types/jest": "^29.4.0",
    "@types/node": "18.16.9",
    "@typescript-eslint/eslint-plugin": "^7.3.0",
    "@typescript-eslint/parser": "^7.3.0",
    "@typescript-eslint/utils": "^8.0.0-alpha.28",
    "autoprefixer": "^10.4.0",
    "eslint": "~8.57.0",
    "eslint-config-prettier": "^9.0.0",
    "jest": "^29.4.1",
    "jest-environment-jsdom": "^29.4.1",
    "jest-environment-node": "^29.4.1",
    "jest-preset-angular": "~14.1.0",
    "nx": "19.1.1",
    "postcss": "^8.4.5",
    "prettier": "^3.3.2",
    "tailwindcss": "^3.0.2",
    "ts-jest": "^29.1.0",
    "ts-node": "10.9.1",
    "typescript": "~5.4.2",
    "webpack-cli": "^5.1.4"
  },
  "nx": {}
}

after build my app the generated package.json is following:

{
  "name": "api",
  "version": "0.0.1",
  "dependencies": {
    "@nestjs/common": "10.3.9",
    "@nestjs/core": "10.3.9",
    "@nestjs/platform-express": "10.3.9",
    "@nestjs/serve-static": "4.0.2",
    "@nestjs/swagger": "7.3.1",
    "@nestjs/typeorm": "10.0.2",
    "reflect-metadata": "0.1.14",
    "rxjs": "7.8.1",
    "tslib": "2.6.3",
    "typeorm": "0.3.20"
  },
  "main": "main.js"
}

now can can not startup the app because the "mssql" package is missing

Expected Behavior

the mssql package should be included in the generated package json

GitHub Repo

No response

Steps to Reproduce

  1. nx build api

Nx Report

`NX   Report complete - copy this into the issue template

Node   : 20.12.2
OS     : linux-x64
npm    : 10.8.1

nx (global)        : 19.3.0
nx                 : 19.3.0
@nx/js             : 19.3.0
@nx/jest           : 19.3.0
@nx/linter         : 19.3.0
@nx/eslint         : 19.3.0
@nx/workspace      : 19.3.0
@nx/angular        : 19.3.0
@nx/devkit         : 19.3.0
@nx/eslint-plugin  : 19.3.0
@nx/nest           : 19.3.0
@nx/node           : 19.3.0
@nrwl/tao          : 19.3.0
@nx/web            : 19.3.0
@nx/webpack        : 19.3.0
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/webpack/plugin`

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

scope: nodeIssues related to Node, Express, NestJS support for Nxtype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions