Closed jerkovicl closed 1 year ago
I have the same issue. Nx version: 15.8.1
At the: 'nx@15.8.1/node_modules/nx/src/generators/utils/project-configuration.js' it looks for 'angular.json' file which was removed when the migrations were run.
function readProjectConfiguration(tree, projectName) {
const allProjects = readAndCombineAllProjectConfigurations(tree);
if (!allProjects[projectName]) {
// temporary polyfill to make sure our generators work for existing angularcli workspaces
if (tree.exists('angular.json')) {
const angularJson = toNewFormat((0, json_1.readJson)(tree, 'angular.json'));
if (angularJson.projects[projectName])
return angularJson.projects[projectName];
}
throw new Error(`Cannot find configuration for '${projectName}'`);
}
return allProjects[projectName];
}
@hackmajoris yeah I am missing angular.json as well after migrations removed it
Thanks for reporting this!
I couldn't reproduce the issue in a freshly generated 15.8.1 repo on Windows. Could you provide a repo where the issue can be reproduced so we can troubleshoot it?
Thanks for reporting this!
I couldn't reproduce the issue in a freshly generated 15.8.1 repo on Windows. Could you provide a repo where the issue can be reproduced so we can troubleshoot it?
@jerkovicl will you?
@hackmajoris cant do it before Monday, if you can do it before, it would be great.
@jerkovicl @leosvelperez fixed it. Here is how: I use PNPM as a package manager. I had a file 'pnpm-workspace.yml' from the beginning and it worked well with older Nx versions. With the latest upgrade, the angular.json file was split and removed and it started to give that missing configuration error. After removing pnpm-workspace.yml file it worked. I assume it tries different configuration(the one with angular.json) when you have that file.
@leosvelperez you should be able to reproduce the issue with PNPM and pnpm-worspace.yml file.
@hackmajoris i am using npm as package manager
@hackmajoris i am using npm as package manager
Do you have a 'workspaces' attribute on your package.json file?
@hackmajoris i am using npm as package manager
Do you have a 'workspaces' attribute on your package.json file?
Nope, only nx attribute:
"nx": {
"tags": [
"type:app"
]
},
@leosvelperez i sent you a repo on dm in slack community so you can reproduce issue
@jerkovicl I've had the same issue when trying to create a library. I've removed the nx property from my root package.json file, and it has worked well. Not sure what was the issue, but I think it has to do with how Nx creates a "base" project when you define an nx property in the root package.json file.
@jerkovicl thanks for the repro! I'll try to set some time later this week to look at this. In the meantime, as mentioned by @aleix10kst, removing the nx
property in the root package.json
would fix your workspace. If your root is not an Nx project, you shouldn't have that property set there. If you need the root dir to be considered an Nx project (and have the rest of the projects as nested projects), you can consider creating a project.json
file at the root instead.
@aleix10kst @leosvelperez yep removing nx property fixed it for me, thx for help🍾
Should I close this or leave it open?
Thanks for confirming it worked for you! Yeah, I'm closing the issue since it seems to have been caused by a wrong setup.
Anyways, I'll spend later some time on it. A nested setup with the nx
property in the package.json
should still work, though that was not what you needed or were trying to achieve.
@leosvelperez but based on this guide, you can have the property there to run root-level scripts (which was my case) and it should work. Am I missing something?
@aleix10kst you're correct. That's what I said I'll take a look later. I closed this because the OP wasn't using that and their issue was solved. I'll reopen it to track what you mention.
@leosvelperez but based on this guide, you can have the property there to run root-level scripts (which was my case) and it should work. Am I missing something?
Yeah if i remember correctly i added nx prop because of that feature when i saw it in release blog post but never used it so far
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.
Current Behavior
I have a working nx workspace with 1 angular app and multiple libs. I am on latest angular v15.2 and nx v15.8.1 Tried generating a new angular app but got error. `
Expected Behavior
Generating a new angular app inside existing nx workspace works
GitHub Repo
No response
Steps to Reproduce
nx g @nrwl/angular:application my-app
inside existing nx workspaceNx Report
Failure Logs
Additional Information
No response