Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Repo: Many dev commands require a global nx command #7987

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

Closed
JoshuaKGoldberg opened this issue Nov 24, 2023 · 2 comments · Fixed by #7988
Closed

Repo: Many dev commands require a global nx command #7987

JoshuaKGoldberg opened this issue Nov 24, 2023 · 2 comments · Fixed by #7988
Labels
repo maintenance things to do with maintenance of the repo, and not with code/docs triage Waiting for team members to take a look

Comments

@JoshuaKGoldberg
Copy link
Member

Suggestion

Commands prefixed with nx (e.g. nx run ...) require either something like npx nx in front or a global nx script, such as from npm i -g npm. If you don't then trying to run them gives an error:

josh ~/repos/typescript-eslint/packages/website $ yarn start
command not found: nx

Running a search for ": "nx in package.json files, we get 40 results in 18 files right now.

I think we have two likely workarounds:

  • Explicitly require dev machines have run something like npm i -g nx
  • Prefix all those commands with something like npx (e.g. instead of `nnx
@JoshuaKGoldberg JoshuaKGoldberg added triage Waiting for team members to take a look repo maintenance things to do with maintenance of the repo, and not with code/docs labels Nov 24, 2023
@merceyz
Copy link

merceyz commented Nov 24, 2023

That is because your workspaces (website in this case) doesn't declare any dependencies that provide a nx binary, if you want to use the nx binary from the root workspace you need to use yarn run -T nx or run -T nx.

Ref https://yarnpkg.com/getting-started/qa#how-to-share-scripts-between-workspaces

@JoshuaKGoldberg
Copy link
Member Author

Ah thanks for bringing this up!

Per https://docs.npmjs.com/cli/v8/commands/npx:

If any requested packages are not present in the local project dependencies, then they are installed to a folder in the npm cache, which is added to the PATH environment variable in the executed process. A prompt is printed (which can be suppressed by providing either --yes or --no).

When I run npx npx --version in typescript-eslint, no prompt is given, and it prints the locally installed version:

 $ npx nx --version
Nx Version:
- Local: v17.1.2
- Global: Not found

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
repo maintenance things to do with maintenance of the repo, and not with code/docs triage Waiting for team members to take a look
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants