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

Error: > NX Cannot update Project header at packages/header. It doesn't exist or uses package.json configuration. #634

Closed
MuthupandiG opened this issue Jan 12, 2023 · 12 comments
Labels
bug Something isn't working

Comments

@MuthupandiG
Copy link

MuthupandiG commented Jan 12, 2023

Hi Team,
I have upgraded my monorepo from Lerna (v3) to Nx (v15) and I m using workspaces config in package.json for dependency installation instead of lerna bootstrap and the Node Env is v16.5 However, I am getting below error when running

nx g @jscutlery/semver:install

package.json config:

"workspaces": [
"packages/**"
]

Selected Options:

NX Generating @jscutlery/semver:ng-add

✔ Lock/sync versions between packages? (y/N) · false
✔ Enforce conventional commits? (Y/n) · true
? Which projects would you like to version independently? Selected Header project

And, the error is:

NX Cannot update Project header at packages/header. It doesn't exist or uses package.json configuration.

@MuthupandiG
Copy link
Author

Verbose error:

Cannot update Project header at packages/header. It doesn't exist or uses package.json configuration.
at validateProjectConfigurationOperationsWithoutWorkspaceJson (/Users/xxxx/Documents/Lerna_Nx/projectA/node_modules/@jscutlery/semver/node_modules/@nrwl/devkit/src/generators/project-configuration.js:355:15)

@herrlegno
Copy link

I'm getting the same error with a fresh install with nx:

image
image

@edbzn edbzn added the bug Something isn't working label Mar 10, 2023
@edbzn
Copy link
Member

edbzn commented Mar 10, 2023

@herrlegno could you provide the output of nx report please?

@herrlegno
Copy link

@herrlegno can you provide the output of nx report please?

image

@herrlegno
Copy link

@edbzn is there a way to migrate from package.json to project.json that seems to be the way to be able to use this versioning plugin?

@herrlegno
Copy link

@edbzn I found a workaround to make it work. Just add a project.json file with:

{
  "name": <project name>,
  "targets":{}
}

before running

ng g @jscutlery/semver:install

It will add the nx runners to it, and if you run:

nx affected --target version [...options]

after the commits it will run as expected.

For reference after doing what I described in one of my packages I this project.json:

{
  "name": "eslint-config",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "targets": {
    "version": {
      "executor": "@jscutlery/semver:version",
      "options": {
        "preset": "conventional"
      }
    }
  }
}

@herrlegno
Copy link

@edbzn Today I wanted to update a package but it's not working again:

image

It doesn't detect the changes

@edbzn
Copy link
Member

edbzn commented Mar 23, 2023

@herrlegno does it work when using run-many command?

nx run-many --target version 

@herrlegno
Copy link

Kinda works but It creates also versions for packages that are not modified. Also git is executed in parallel and it doesn't like to do that:

image

@edbzn
Copy link
Member

edbzn commented Mar 23, 2023

Yeah, you have to explicitly give --parallel=1 for the concurrent Git access, anyway run-many is not what you need. I checked and it seems that actually, our executor is not compatible with package.json based projects. This is something we need to consider in #655, but for now, you need to use a project.json file to be able to configure executors.

@herrlegno
Copy link

herrlegno commented Mar 24, 2023

@edbzn Today I wanted to update a package but it's not working again:

image

It doesn't detect the changes

@edbzn sorry for bothering you again. I found out the problem that i mentioned was because i was running affected version with main as base branch and the commits were on main so there was no change. After changing the base branch to origin/main it runs perfectly.

Running this (in my example) works as expected:

nx affected --target version --base=origin/main --parallel=1

image

Sorry for all the trouble, first time using Nx Automatic versioning.

@edbzn
Copy link
Member

edbzn commented Mar 24, 2023

No problem! Happy it works for you.

@edbzn edbzn closed this as completed Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants