nx icon indicating copy to clipboard operation
nx copied to clipboard

Convert to monorepo fails automatically. Manually also fails

Open roldengarm opened this issue 1 year ago • 2 comments

Current Behavior

I'm trying to convert from a standalone repo to a mono repo using this documentation, but it's failing both using the nx command as well as the manual steps.

Expected Behavior

I can successfully convert to a mono repo

GitHub Repo

No response

Steps to Reproduce

  1. Run nx g convert-to-monorepo

OR

  1. Delete tsconfig.json
  2. Run nx g app temp

Nx Report

NX   Report complete - copy this into the issue template

Node   : 18.19.1
OS     : win32-x64
npm    : 10.2.4

nx (global)        : 18.3.4
nx                 : 18.3.4
@nx/js             : 18.3.4
@nx/jest           : 18.3.4
@nx/linter         : 18.3.4
@nx/eslint         : 18.3.4
@nx/workspace      : 18.3.4
@nx/angular        : 18.3.4
@nx/cypress        : 18.3.4
@nx/devkit         : 18.3.4
@nx/eslint-plugin  : 18.3.4
@nx/storybook      : 18.3.4
@nrwl/tao          : 18.3.4
@nx/web            : 18.3.4
@nx/webpack        : 18.3.4
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin
@nx/cypress/plugin
@nx/storybook/plugin
---------------------------------------
Community plugins:
@fortawesome/angular-fontawesome : 0.14.1
@ng-bootstrap/ng-bootstrap       : 16.0.0
@storybook/angular               : 7.6.17
apollo-angular                   : 6.0.0
ngx-toastr                       : 18.0.0

Failure Logs

nx g convert-to-monorepo --verbose

 NX  Generating @nx/workspace:convert-to-monorepo


 NX   The following projects are defined in multiple locations:

- PROJECT_NAME:
  - .
  - apps/PROJECT_NAME

To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.

ProjectsWithConflictingNamesError: The following projects are defined in multiple locations:
- PROJECT_NAME:
  - .
  - apps/PROJECT_NAME

---
And manual approach:

$ nx g app temp
Convert compiler options from json failed, Cannot read file 'D:/projects/PROJECT_NAME/tsconfig.json'.
Convert compiler options from json failed, Cannot read file 'D:/projects/PROJECT_NAME/tsconfig.json'.

 NX   Failed to process project graph.

Package Manager Version

No response

Operating System

  • [ ] macOS
  • [ ] Linux
  • [X] Windows
  • [ ] Other (Please specify)

Additional Information

No response

roldengarm avatar Apr 29 '24 08:04 roldengarm

The error message is telling you that the package.json or project.json at the root has a name set that conflicts with the package.json or project.json in the individual project's root.

You can fix the error by updating either name.

Can you create a reproduction for us the better diagnose the root cause of this?

AgentEnder avatar Apr 29 '24 14:04 AgentEnder

@AgentEnder thanks for the prompt reply! It was indeed the name in package.json I had not changed it since the initial generation, so I guess if you would create a standalone repo with default values and then run nx g convert-to-monorepo it will cause the same error.

Didn't know nx would also look there for project information.

I could run it, but ran into a couple of things I had to fix manually:

  • /tsconfig.json and /.eslintrc.json were missing => copied manually from another project
  • .eslintrc.base.json referred itself, causing call stack exceeded
  • Had to manually fix Tailwind & Storybook

Not major, the generator definitely helped. Thanks again.

roldengarm avatar Apr 29 '24 19:04 roldengarm

Seems like this is resolved :) If there are any other problems that persists, feel free to create a new issue for those specifically.

MaxKless avatar Jul 26 '24 13:07 MaxKless

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.

github-actions[bot] avatar Aug 26 '24 00:08 github-actions[bot]