GeneratePackgageJson : true Doesn't have any package in package.json
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
- 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
- [X] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
No response
Can you create a small repro, This is working for me.
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! ๐
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! ๐
Same issue when upgrading from 19.0.4 to 19.5.3 with pnpm 8.15.7 and node 20.10.0
Suddenly no dependencies listed in the generated package.json for any of my apps
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! ๐
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.