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

On nx 14.0.3 -- nx migrate latest fails #10144

Closed
fbartho opened this issue May 4, 2022 · 5 comments · Fixed by #10225
Closed

On nx 14.0.3 -- nx migrate latest fails #10144

fbartho opened this issue May 4, 2022 · 5 comments · Fixed by #10225
Labels
blocked: retry with latest Retry with latest release or head. outdated scope: core core nx functionality type: bug

Comments

@fbartho
Copy link

fbartho commented May 4, 2022

Current Behavior

$ yarn nx migrate latest
yarn run v1.22.17
[shortened]/node_modules/.bin/nx migrate latest

 ERROR  The migrate command failed.

Cannot read properties of undefined (reading 'split')

Expected Behavior

I expect nx migrate latest to always succeed -- either it does nothing, or it updates package.json

Steps to Reproduce

  1. Create a package.json with the following packages
{
  "devDependencies": {
     		"@nrwl/cli": "14.0.0",
		"@nrwl/eslint-plugin-nx": "14.0.1",
		"@nrwl/express": "14.0.1",
		"@nrwl/jest": "14.0.2",
		"@nrwl/linter": "14.0.0",
		"@nrwl/node": "14.0.2",
		"@nrwl/nx-cloud": "13.3.1",
		"@nrwl/workspace": "14.0.1",
		"nx": "14.0.3",
  }
}
  1. create a working nx.json / workspace.json
  2. run yarn nx migrate latest

Failure Logs

Environment

$ yarn nx report
yarn run v1.22.17
[shortened]/node_modules/.bin/nx report

 >  NX   Report complete - copy this into the issue template

   Node : 16.13.2
   OS   : darwin arm64
   yarn : 1.22.17
   
   nx : 14.0.3
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.0.1
   @nrwl/eslint-plugin-nx : 14.0.1
   @nrwl/express : 14.0.1
   @nrwl/jest : 14.0.2
   @nrwl/js : 14.0.2
   @nrwl/linter : 14.0.0
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : 14.0.2
   @nrwl/nx-cloud : 13.3.1
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 14.0.1
   typescript : 4.6.4
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:

✨  Done in 0.51s.

Related ticket: #10086

@AgentEnder AgentEnder added blocked: retry with latest Retry with latest release or head. scope: core core nx functionality labels May 4, 2022
@AgentEnder
Copy link
Member

Hey @fbartho! Do you care to try this again? There have been some fixes published that may have touched this area.

@fbartho
Copy link
Author

fbartho commented May 4, 2022

@AgentEnder it still fails exactly as described above! let me know if you want me to try to yarn nx migrate latest with any particular magic logging CLI arguments or Environment Variables.

@fbartho
Copy link
Author

fbartho commented May 9, 2022

@AgentEnder this was introduced by #9849, embedding the context here:

Specifically, it assumes that devDependencies exists and has versions for either package. Then it passes undefined to isMigratingToNewMajor which then passes undefined to normalizeVersion which expects a non-null string, so then that throws an error.

Further context on why: We use @manykg/cli to manage our monorepo dependencies, which has an additional rule that the top level package.json in a monorepo doesn't have a distinction between shipping deps and devDeps, so it recommends and enforces that you should just have one dependencies hash.

The Migrator code below takes this into account, but this marketing code does not. Using stricter null-type checking on your tsconfig or linter settings would have flagged this section as potentially problematic.

Specific comments found here:

Please let me know if you need anything further, if necessary I can potentially submit a PR for this issue as it's still causing problems in our repository..

@fbartho
Copy link
Author

fbartho commented May 9, 2022

Further info: this sometimes, but not always* replicates with a global install of nx, but it always replicates in our project when using the package.json-based install of nx.

*: different developer machines see different behavior

@github-actions
Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked: retry with latest Retry with latest release or head. outdated scope: core core nx functionality type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants