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

package.json generated locally is sometimes ok, but never during build on github #28985

Open
2 of 4 tasks
miszczu-drako opened this issue Nov 19, 2024 · 0 comments
Open
2 of 4 tasks

Comments

@miszczu-drako
Copy link

Current Behavior

I have a brand new nx workspace, a simple node application + express framework.
The app is located is apps folder
There are also 3 libs generated this way:
npx nx generate @nx/node:library --name=my-app-api --directory=libs/my-app/api --importPath=@mtc/my-app-api --projectNameAndRootFormat=as-provided --strict=true --testEnvironment=node --no-interactive

  • my-app imports express and my-app-api lib
  • my-app-api lib imports my-app-service and my-app-util libs
  • my-app-service lib imports pino
  • my-app-util lib imports uuid

When I run npx nx run my-app:build locally on my machine, the generated dist/apps/my-app/package.json file in most cases looks like this:

{
  "name": "my-app",
  "version": "0.0.1",
  "dependencies": {
    "express": "4.18.3",
    "pino": "9.5.0",
    "uuid": "11.0.3"
  },
  "main": "./main.js",
  "type": "commonjs"
}

Sometimes express dependency is missing

However when I run the same command in github action https://github.com/miszczu-drako/nx-issue/blob/main/.github/workflows/ci.yml line 39, the generated package.json looks like this in all cases:

{
  "name": "my-app",
  "version": "0.0.1",
  "main": "./main.js",
  "type": "commonjs"
}

Here's a sample of workflow run
https://github.com/miszczu-drako/nx-issue/actions/runs/11902565506/job/33167834974

Expected Behavior

The generated package.json should have all dependencies listed

GitHub Repo

https://github.com/miszczu-drako/nx-issue

Steps to Reproduce

  1. just trigger a workflow on github and see the output of cat dist/apps/my-app/package.json

Nx Report

$ npx nx report

 NX   Report complete - copy this into the issue template

Node           : 22.11.0
OS             : win32-x64
Native Target  : x86_64-windows
npm            : 10.9.0

nx                 : 20.1.2
@nx/js             : 20.1.2
@nx/jest           : 20.1.2
@nx/eslint         : 20.1.2
@nx/workspace      : 20.1.2
@nx/devkit         : 20.1.2
@nx/esbuild        : 20.1.2
@nx/eslint-plugin  : 20.1.2
@nx/node           : 20.1.2
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin

Failure Logs

Package Manager Version

No response

Operating System

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

Additional Information

I think that it broke around nx version 19.1

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

1 participant