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

GeneratePackgageJson : true Doesn't have any package in package.json #26744

Open
1 of 4 tasks
QQbit opened this issue Jun 28, 2024 · 2 comments
Open
1 of 4 tasks

GeneratePackgageJson : true Doesn't have any package in package.json #26744

QQbit opened this issue Jun 28, 2024 · 2 comments

Comments

@QQbit
Copy link

QQbit commented Jun 28, 2024

Current Behavior

Building with option generatePackageJson: true in project.json produces a package.json file is not have anything.

{
  "name": "backend",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "sourceRoot": "apps/backend/src",
  "projectType": "application",
  "targets": {
    "build": {
      "executor": "@nx/esbuild:esbuild",
      "outputs": ["{options.outputPath}"],
      "defaultConfiguration": "production",
      "options": {
        "platform": "node",
        "outputPath": "dist/apps/backend",
        "format": ["cjs"],
        "bundle": false,
        "main": "apps/backend/src/main.ts",
        "tsConfig": "apps/backend/tsconfig.app.json",
        "generatePackageJson": true,
        "esbuildOptions": {
          "sourcemap": true,
          "outExtension": {
            ".js": ".js"
          }
        }
      },
      "configurations": {
        "development": {},
        "production": {
          "esbuildOptions": {
            "sourcemap": false,
            "outExtension": {
              ".js": ".js"
            }
          }
        }
      }
    },
    "serve": {
      "executor": "@nx/js:node",
      "defaultConfiguration": "development",
      "options": {
        "buildTarget": "backend:build"
      },
      "configurations": {
        "development": {
          "buildTarget": "backend:build:development"
        },
        "production": {
          "buildTarget": "backend:build:production"
        }
      }
    },
    "lint": {
      "executor": "@nx/linter:eslint",
      "outputs": ["{options.outputFile}"],
      "options": {
        "lintFilePatterns": ["apps/backend/**/*.ts"]
      }
    },
    "test": {
      "executor": "@nx/jest:jest",
      "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
      "options": {
        "jestConfig": "apps/backend/jest.config.ts",
        "passWithNoTests": true
      },
      "configurations": {
        "ci": {
          "ci": true,
          "codeCoverage": true
        }
      }
    },
    "docker-build": {
      "dependsOn": ["build"],
      "command": "docker build -f apps/backend/Dockerfile . -t backend"
    }
  },
  "tags": []
}

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

{
  "name": "backend",
  "version": "0.0.1",
  "main": "./main.js"
}

Now I can't startup the app in my docker container is not found module because the package no have anythings.

Expected Behavior

package should be included in the generated package json

GitHub Repo

No response

Steps to Reproduce

  1. pnpm backend:build

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 20.11.1
   OS     : darwin arm64
   pnpm   : 9.4.0
   Hasher : Native
   
   nx                 : 16.3.2
   @nx/js             : 16.3.2
   @nx/jest           : 16.3.2
   @nx/linter         : 16.3.2
   @nx/workspace      : 16.3.2
   @nx/cypress        : 16.3.2
   @nx/devkit         : 16.3.2
   @nx/esbuild        : 16.3.2
   @nx/eslint-plugin  : 16.3.2
   @nx/next           : 16.3.2
   @nx/node           : 16.3.2
   @nx/react          : 16.3.2
   @nrwl/tao          : 16.3.2
   @nx/vite           : 16.3.2
   @nx/web            : 16.3.2
   typescript         : 5.0.2
   ---------------------------------------
   Community plugins:
   @nx/eslint  : 17.1.3
   nx-electron : 17.0.1

Failure Logs

No response

Package Manager Version

pnpm 9.4.0

Operating System

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

Additional Information

No response

@QQbit QQbit changed the title GeneratePackgageJson : true not have any package in package.json GeneratePackgageJson : true Doesn't have any package in package.json Jun 28, 2024
@ndcunningham
Copy link
Contributor

Can you create a small repro, This is working for me.

Copy link

github-actions bot commented Jul 6, 2024

This issue has been automatically marked as stale because no reproduction was provided within 7 days.
Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue.
Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues.
This issue will be closed in 21 days if a reproduction is not provided.
If a reproduction has been provided, please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants