docs(core): brew install nx (#30571)

Adds instructions to install Nx globally with Homebrew
This commit is contained in:
Isaac Mann 2025-04-01 16:34:05 -04:00 committed by GitHub
parent 85bb61f9e0
commit b50727adb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 57 additions and 6 deletions

View File

@ -77,6 +77,14 @@ You can also manually install the nx NPM package and create a [nx.json](/referen
You can install Nx globally. Depending on your package manager, use one of the following commands: You can install Nx globally. Depending on your package manager, use one of the following commands:
{% tabs %} {% tabs %}
{% tab label="Homebrew" %}
```shell
brew tap nrwl/nx
brew install nx
```
{% /tab %}
{% tab label="npm" %} {% tab label="npm" %}
```shell ```shell

View File

@ -7,12 +7,38 @@ description: Learn how to install and use Nx in repositories that don't contain
Nx can manage its own installation without requiring a `package.json` file or a `node_modules` folder. This type of installation is useful for repositories that may not contain any JavaScript or TypeScript (e.g. .Net or Java based workspaces that want to leverage Nx features). In this setup, the Nx CLI is all contained within a `.nx` folder. Nx can manage its own installation without requiring a `package.json` file or a `node_modules` folder. This type of installation is useful for repositories that may not contain any JavaScript or TypeScript (e.g. .Net or Java based workspaces that want to leverage Nx features). In this setup, the Nx CLI is all contained within a `.nx` folder.
## Usage ## Globally Install Nx
You can install Nx in the `.nx/installation` directory by running `nx init` in a directory without a `package.json` file. First globally install Nx using Homebrew (Mac only) or with a manually installed version of Node (any OS).
{% tabs %}
{% tab label="Homebrew" %}
If you have [Homebrew installed](https://brew.sh/), you can install Nx globally with these commands:
```shell ```shell
npx nx init brew tap nrwl/nx
brew install nx
```
{% /tab %}
{% tab label="Node" %}
If you have [Node installed](https://nodejs.org/en/download), you can install Nx globally with this command:
```shell
npm install --global nx
```
{% /tab %}
{% /tabs %}
## Usage
You can install Nx in the `.nx/installation` directory of your repository by running `nx init` in a directory without a `package.json` file.
```shell
nx init
``` ```
When Nx is installed in `.nx`, you can run Nx via a global Nx installation or the nx and nx.bat scripts that were created. In either case, the wrapper (.nx/nxw.js) will be invoked and ensure that the current workspace is up to date prior to invoking Nx. When Nx is installed in `.nx`, you can run Nx via a global Nx installation or the nx and nx.bat scripts that were created. In either case, the wrapper (.nx/nxw.js) will be invoked and ensure that the current workspace is up to date prior to invoking Nx.

View File

@ -27,13 +27,30 @@ To verify that Gradle was installed correctly, run this command:
gradle --version gradle --version
``` ```
Nx also requires NodeJS to be installed. If you do not have NodeJS installed, you can To streamline this tutorial, we'll install Nx globally on your system. You can use Homebrew (Mac only) or a manually installed Node version (any OS).
install it from the [NodeJS website](https://nodejs.org/en/download).
{% tabs %}
{% tab label="Homebrew" %}
Make sure [Homebrew is installed](https://brew.sh/), then install Nx globally with these commands:
```shell ```shell
node -v brew tap nrwl/nx
brew install nx
``` ```
{% /tab %}
{% tab label="Node" %}
Install node from the [NodeJS website](https://nodejs.org/en/download), then install Nx globally with this command:
```shell
npm install --global nx
```
{% /tab %}
{% /tabs %}
## Getting Started ## Getting Started
This tutorial picks up where [Spring framework](https://spring.io/)'s guide for [Multi-Module Projects](https://spring.io/guides/gs/multi-module) leaves off. This tutorial picks up where [Spring framework](https://spring.io/)'s guide for [Multi-Module Projects](https://spring.io/guides/gs/multi-module) leaves off.