nx
nx copied to clipboard
Could not add the plugin in a way which does not conflict with existing targets.
Current Behavior
i try nestjs app via nx (npx nx g @nx/nest:app bff )
Expected Behavior
create nestjs app in workspace
GitHub Repo
No response
Steps to Reproduce
- create workspace
- npx nx add @nx/nest
- npx nx g @nx/nest:app bff
Nx Report
npx nx g @nx/nest:app bff --frontendProject shell --verbose --directory apps/nodes
NX Generating @nx/nest:application
✔ What should be the project name and where should it be generated? · bff @ apps/nodes
NX Could not add the plugin in a way which does not conflict with existing targets. Please report this error at: https://github.com/nrwl/nx/issues/new/choose
Failure Logs
Error: Could not add the plugin in a way which does not conflict with existing targets. Please report this error at: https://github.com/nrwl/nx/issues/new/choose
at addPlugin (/my-project/node_modules/@nx/devkit/src/utils/add-plugin.js:62:15)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at webpackInitGeneratorInternal (/my-project/node_modules/@nx/webpack/src/generators/init/init.js:18:9)
at applicationGeneratorInternal (/my-project/node_modules/@nx/node/src/generators/application/application.js:304:33)
at applicationGenerator (/my-project/node_modules/@nx/node/src/generators/application/application.js:265:12)
at applicationGeneratorInternal (/my-project/node_modules/@nx/nest/src/generators/application/application.js:25:33)
at /my-project/node_modules/nx/src/command-line/generate/generate.js:241:26
at handleErrors (/my-project/node_modules/nx/src/utils/params.js:9:16)
at Object.handler (/my-project/node_modules/nx/src/command-line/generate/command-object.js:13:22)
Package Manager Version
npm
Operating System
- [ ] macOS
- [X] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
No response
Same issue on windows
Same issue on macOS
Same issue on MacOS at this command:
nx g @nx/storybook:configuration <project-name> --interactionTests=true --uiFramework=@storybook/react-webpack5
Library's project.json:
{
"name": "<project-name>",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/<project-name>",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:swc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/<project-name>",
"main": "libs/<project-name>/index.ts",
"tsConfig": "libs/<project-name>/tsconfig.lib.json",
"assets": ["libs/<project-name>/*.md"]
}
},
"publish": {
"command": "node tools/scripts/publish.mjs <project-name> {args.ver} {args.tag}"
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/<project-name>/**/*.ts"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/<project-name>/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
},
"cli": {
"command": "node ./libs/<project-name>/cli.js"
}
},
"tags": []
}
This appears to be caused by the @nx/webpack/plugin
Any workaround ? I get the same when I try to add an express application to an existing monorepo with React MFE
I had to run the command by disabling plugins to get a new app created
NX_ADD_PLUGINS=false yarn exec nx g app my-app --bundler webpack --e2eTestRunner none --directory apps/my-app --verbose
NX_ADD_PLUGINS=false yarn exec nx g app my-app --bundler webpack --e2eTestRunner none --directory apps/my-app --verbose
It works on my PC (Ubuntu), but I'm not sure if all the configurations in NX are correct.
yarn exec v1.22.19
verbose 0.126478172 Checking for configuration file "/workspaces/container/mfe/.npmrc".
verbose 0.126672891 Checking for configuration file "/usr/local/share/.npmrc".
verbose 0.12677619 Checking for configuration file "/usr/local/etc/npmrc".
verbose 0.126914599 Found configuration file "/usr/local/etc/npmrc".
verbose 0.127105833 Checking for configuration file "/root/.npmrc".
verbose 0.12729118 Checking for configuration file "/workspaces/container/mfe/.npmrc".
verbose 0.127461422 Checking for configuration file "/workspaces/container/.npmrc".
verbose 0.12765076 Checking for configuration file "/workspaces/.npmrc".
verbose 0.128660058 Checking for configuration file "/workspaces/container/mfe/.yarnrc".
verbose 0.128744855 Checking for configuration file "/usr/local/share/.yarnrc".
verbose 0.128866622 Checking for configuration file "/usr/local/etc/yarnrc".
verbose 0.128944288 Checking for configuration file "/root/.yarnrc".
verbose 0.129015837 Checking for configuration file "/workspaces/container/mfe/.yarnrc".
verbose 0.129074667 Checking for configuration file "/workspaces/container/.yarnrc".
verbose 0.129135634 Checking for configuration file "/workspaces/.yarnrc".
verbose 0.131327306 current time: 2024-05-24T14:58:19.255Z
✔ Which generator would you like to use? · @nx/nest:application
NX Generating @nx/nest:application
CREATE main-api-manage/src/assets/.gitkeep
CREATE main-api-manage/src/main.ts
CREATE main-api-manage/tsconfig.app.json
CREATE main-api-manage/tsconfig.json
CREATE main-api-manage/webpack.config.js
CREATE main-api-manage/project.json
CREATE main-api-manage/.eslintrc.json
CREATE main-api-manage/jest.config.ts
CREATE main-api-manage/tsconfig.spec.json
CREATE main-api-manage-e2e/project.json
CREATE main-api-manage-e2e/jest.config.ts
CREATE main-api-manage-e2e/src/main-api-manage/main-api-manage.spec.ts
CREATE main-api-manage-e2e/src/support/global-setup.ts
CREATE main-api-manage-e2e/src/support/global-teardown.ts
CREATE main-api-manage-e2e/src/support/test-setup.ts
CREATE main-api-manage-e2e/tsconfig.json
CREATE main-api-manage-e2e/tsconfig.spec.json
CREATE main-api-manage-e2e/.eslintrc.json
CREATE main-api-manage/src/app/app.controller.spec.ts
CREATE main-api-manage/src/app/app.controller.ts
CREATE main-api-manage/src/app/app.module.ts
CREATE main-api-manage/src/app/app.service.spec.ts
CREATE main-api-manage/src/app/app.service.ts
NX 👀 View Details of main-api-manage-e2e
Run "nx show project main-api-manage-e2e --web" to view details about this project.
NX 👀 View Details of main-api-manage
Run "nx show project main-api-manage --web" to view details about this project.
Done in 4.36s.
i had same and ... added this to nx.json and worked
"plugins": [
{
"plugin": "@nx/webpack/plugin",
"options": {
"buildTargetName": "build",
"serveTargetName": "serve",
"previewTargetName": "preview"
}
]
**Node : 20.12.2 OS : darwin-arm64 pnpm : 8.14.3
nx (global) : 19.2.3 nx : 19.2.2 @nx/js : 19.2.2 @nx/jest : 19.2.2 @nx/eslint : 19.2.2 @nx/workspace : 19.2.2 @nx/angular : 19.2.2 @nx/eslint-plugin : 19.2.2 @nx/nest : 19.2.2 @nx/node : 19.2.2 @nrwl/tao : 19.2.3 @nx/web : 19.2.2 @nx/webpack : 19.2.2 typescript : 5.4.5**
Hey all, I have not been able to reproduce this. Could someone please provide a repo on the latest version that we can pull down where nx g @nx/nest:application
will fail?
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.