docs(core): installation recipes
This commit is contained in:
parent
d946d2e2d6
commit
342546ca41
@ -2076,6 +2076,31 @@
|
||||
],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Installation",
|
||||
"path": "/recipes/installation",
|
||||
"id": "installation",
|
||||
"isExternal": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "Install Nx in a Non-Javascript Repo",
|
||||
"path": "/recipes/installation/install-non-javascript",
|
||||
"id": "install-non-javascript",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Update Your Global Nx Installation",
|
||||
"path": "/recipes/installation/update-global-installation",
|
||||
"id": "update-global-installation",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
}
|
||||
],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Tips and tricks",
|
||||
"path": "/recipes/tips-n-tricks",
|
||||
@ -3554,6 +3579,47 @@
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Installation",
|
||||
"path": "/recipes/installation",
|
||||
"id": "installation",
|
||||
"isExternal": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "Install Nx in a Non-Javascript Repo",
|
||||
"path": "/recipes/installation/install-non-javascript",
|
||||
"id": "install-non-javascript",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Update Your Global Nx Installation",
|
||||
"path": "/recipes/installation/update-global-installation",
|
||||
"id": "update-global-installation",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
}
|
||||
],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Install Nx in a Non-Javascript Repo",
|
||||
"path": "/recipes/installation/install-non-javascript",
|
||||
"id": "install-non-javascript",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Update Your Global Nx Installation",
|
||||
"path": "/recipes/installation/update-global-installation",
|
||||
"id": "update-global-installation",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Tips and tricks",
|
||||
"path": "/recipes/tips-n-tricks",
|
||||
|
||||
@ -2588,6 +2588,37 @@
|
||||
"path": "/recipes/enforce-module-boundaries",
|
||||
"tags": []
|
||||
},
|
||||
{
|
||||
"id": "installation",
|
||||
"name": "Installation",
|
||||
"description": "Installing Nx",
|
||||
"file": "",
|
||||
"itemList": [
|
||||
{
|
||||
"id": "install-non-javascript",
|
||||
"name": "Install Nx in a Non-Javascript Repo",
|
||||
"description": "",
|
||||
"file": "shared/recipes/installation/install-non-javascript",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/installation/install-non-javascript",
|
||||
"tags": ["installation"]
|
||||
},
|
||||
{
|
||||
"id": "update-global-installation",
|
||||
"name": "Update Your Global Nx Installation",
|
||||
"description": "",
|
||||
"file": "shared/recipes/installation/update-global-installation",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/installation/update-global-installation",
|
||||
"tags": ["installation"]
|
||||
}
|
||||
],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/installation",
|
||||
"tags": []
|
||||
},
|
||||
{
|
||||
"id": "tips-n-tricks",
|
||||
"name": "Tips and tricks",
|
||||
@ -4432,6 +4463,57 @@
|
||||
"path": "/recipes/enforce-module-boundaries/tags-allow-list",
|
||||
"tags": ["enforce-module-boundaries"]
|
||||
},
|
||||
"/recipes/installation": {
|
||||
"id": "installation",
|
||||
"name": "Installation",
|
||||
"description": "Installing Nx",
|
||||
"file": "",
|
||||
"itemList": [
|
||||
{
|
||||
"id": "install-non-javascript",
|
||||
"name": "Install Nx in a Non-Javascript Repo",
|
||||
"description": "",
|
||||
"file": "shared/recipes/installation/install-non-javascript",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/installation/install-non-javascript",
|
||||
"tags": ["installation"]
|
||||
},
|
||||
{
|
||||
"id": "update-global-installation",
|
||||
"name": "Update Your Global Nx Installation",
|
||||
"description": "",
|
||||
"file": "shared/recipes/installation/update-global-installation",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/installation/update-global-installation",
|
||||
"tags": ["installation"]
|
||||
}
|
||||
],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/installation",
|
||||
"tags": []
|
||||
},
|
||||
"/recipes/installation/install-non-javascript": {
|
||||
"id": "install-non-javascript",
|
||||
"name": "Install Nx in a Non-Javascript Repo",
|
||||
"description": "",
|
||||
"file": "shared/recipes/installation/install-non-javascript",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/installation/install-non-javascript",
|
||||
"tags": ["installation"]
|
||||
},
|
||||
"/recipes/installation/update-global-installation": {
|
||||
"id": "update-global-installation",
|
||||
"name": "Update Your Global Nx Installation",
|
||||
"description": "",
|
||||
"file": "shared/recipes/installation/update-global-installation",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/installation/update-global-installation",
|
||||
"tags": ["installation"]
|
||||
},
|
||||
"/recipes/tips-n-tricks": {
|
||||
"id": "tips-n-tricks",
|
||||
"name": "Tips and tricks",
|
||||
|
||||
@ -1058,6 +1058,22 @@
|
||||
"path": "/recipes/deno/deno-netlify-functions"
|
||||
}
|
||||
],
|
||||
"installation": [
|
||||
{
|
||||
"description": "",
|
||||
"file": "shared/recipes/installation/install-non-javascript",
|
||||
"id": "install-non-javascript",
|
||||
"name": "Install Nx in a Non-Javascript Repo",
|
||||
"path": "/recipes/installation/install-non-javascript"
|
||||
},
|
||||
{
|
||||
"description": "",
|
||||
"file": "shared/recipes/installation/update-global-installation",
|
||||
"id": "update-global-installation",
|
||||
"name": "Update Your Global Nx Installation",
|
||||
"path": "/recipes/installation/update-global-installation"
|
||||
}
|
||||
],
|
||||
"yarn": [
|
||||
{
|
||||
"description": "",
|
||||
|
||||
@ -936,6 +936,25 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Installation",
|
||||
"id": "installation",
|
||||
"description": "Installing Nx",
|
||||
"itemList": [
|
||||
{
|
||||
"name": "Install Nx in a Non-Javascript Repo",
|
||||
"id": "install-non-javascript",
|
||||
"tags": ["installation"],
|
||||
"file": "shared/recipes/installation/install-non-javascript"
|
||||
},
|
||||
{
|
||||
"name": "Update Your Global Nx Installation",
|
||||
"id": "update-global-installation",
|
||||
"tags": ["installation"],
|
||||
"file": "shared/recipes/installation/update-global-installation"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Tips and tricks",
|
||||
"id": "tips-n-tricks",
|
||||
|
||||
@ -90,121 +90,7 @@ pnpm install --global nx@latest
|
||||
|
||||
The advantage of a global installation is that you don't have to prefix your commands with npx, yarn or pnpm. The global Nx installation hands off the process execution to the local Nx installation in your repository, which eliminates any issues with outdated globally installed packages.
|
||||
|
||||
### Updating your global Nx installation
|
||||
## More Documentation
|
||||
|
||||
There are some cases where an issue could arise when using an outdated global installation of Nx. If the structure of your Nx workspace no longer matches up with what the globally installed copy of Nx expects, it may fail to hand off to your local installation properly and instead error. This commonly results in errors such as:
|
||||
|
||||
- `Could not find Nx modules in this workspace.`
|
||||
- `The current directory isn't part of an Nx workspace.`
|
||||
|
||||
If you find yourself in this position, you will need to update your global install of Nx.
|
||||
|
||||
In most cases, you can update a globally installed npm package by rerunning the command you used to install it, as described [above](#installing-nx-globally)
|
||||
|
||||
If you cannot remember which package manager you installed Nx globally with or are still encountering issues, you can locate other installs of Nx with these commands:
|
||||
|
||||
{% tabs %}
|
||||
{% tab label="npm" %}
|
||||
|
||||
```shell
|
||||
npm list --global nx
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="yarn" %}
|
||||
|
||||
```shell
|
||||
yarn global list nx
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="pnpm" %}
|
||||
|
||||
```shell
|
||||
pnpm list --global nx
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% /tabs %}
|
||||
|
||||
{% callout type="note" title="Older Global Installations" %}
|
||||
|
||||
In prior versions, Nx could be installed globally via `@nrwl/cli` or `@nrwl/tao`. If you are seeing these warnings but cannot find other global installations of Nx via the above commands, you should look for these packages as well. In general, you should remove these and install the latest version of `nx` instead.
|
||||
|
||||
{% /callout %}
|
||||
|
||||
You can then remove the extra global installations by running the following commands for the duplicate installations:
|
||||
|
||||
{% tabs %}
|
||||
{% tab label="npm" %}
|
||||
|
||||
```shell
|
||||
npm rm --global nx @nrwl/cli @nrwl/tao
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="yarn" %}
|
||||
|
||||
```shell
|
||||
yarn global remove nx @nrwl/cli @nrwl/tao
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="pnpm" %}
|
||||
|
||||
```shell
|
||||
pnpm rm --global nx @nrwl/cli @nrwl/tao
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% /tabs %}
|
||||
|
||||
Finally, to complete your global installation update, simply reinstall it as described [above](#installing-nx-globally).
|
||||
|
||||
## Self-managed Nx installation
|
||||
|
||||
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 such setup Nx is able to manage its own installation via a `.nx` directory.
|
||||
|
||||
By allowing Nx to manage its installation, a given repository is no longer required to contain a package.json or node_modules in its root.
|
||||
|
||||
### Usage
|
||||
|
||||
You can install Nx in the `.nx/installation` directory by running `nx init` in a directory without package.json, and picking to install Nx in the current directory.
|
||||
|
||||
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.
|
||||
|
||||
{% tabs %}
|
||||
{% tab label="Global Install" %}
|
||||
|
||||
```shell
|
||||
> nx build my-project
|
||||
> nx generate application
|
||||
> nx graph
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="nx shell script" %}
|
||||
|
||||
```shell
|
||||
> ./nx build my-project
|
||||
> ./nx generate application
|
||||
> ./nx graph
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="nx.bat" %}
|
||||
|
||||
```shell
|
||||
> ./nx.bat build my-project
|
||||
> ./nx.bat generate application
|
||||
> ./nx.bat graph
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% /tabs %}
|
||||
|
||||
{% callout type="note" title="Available since Nx v15.8.7" %}
|
||||
|
||||
Support for `--use-dot-nx-installation` was added in Nx v15.8.7. To ensure that it is available, specify the version of nx when running your command so that `npx` doesn't accept an older version that is in the cache. (e.g. `npx nx@latest init`)
|
||||
|
||||
{% /callout %}
|
||||
- [Update Your Global Nx Installation](/recipes/installation/update-global-installation)
|
||||
- [Install Nx in a Non-Javascript Repo](/recipes/installation/install-non-javascript)
|
||||
|
||||
45
docs/shared/recipes/installation/install-non-javascript.md
Normal file
45
docs/shared/recipes/installation/install-non-javascript.md
Normal file
@ -0,0 +1,45 @@
|
||||
# Install Nx in a Non-Javascript Repo
|
||||
|
||||
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
|
||||
|
||||
You can install Nx in the `.nx/installation` directory by running `nx init` in a directory without package.json, and picking to install Nx in the current directory.
|
||||
|
||||
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.
|
||||
|
||||
{% tabs %}
|
||||
{% tab label="Global Install" %}
|
||||
|
||||
```shell
|
||||
> nx build my-project
|
||||
> nx generate application
|
||||
> nx graph
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="nx shell script" %}
|
||||
|
||||
```shell
|
||||
> ./nx build my-project
|
||||
> ./nx generate application
|
||||
> ./nx graph
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="nx.bat" %}
|
||||
|
||||
```shell
|
||||
> ./nx.bat build my-project
|
||||
> ./nx.bat generate application
|
||||
> ./nx.bat graph
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% /tabs %}
|
||||
|
||||
{% callout type="note" title="Available since Nx v15.8.7" %}
|
||||
|
||||
Support for `--use-dot-nx-installation` was added in Nx v15.8.7. To ensure that it is available, specify the version of nx when running your command so that `npx` doesn't accept an older version that is in the cache. (e.g. `npx nx@latest init`)
|
||||
|
||||
{% /callout %}
|
||||
@ -0,0 +1,70 @@
|
||||
# Update Your Global Nx Installation
|
||||
|
||||
There are some cases where an issue could arise when using an outdated global installation of Nx. If the structure of your Nx workspace no longer matches up with what the globally installed copy of Nx expects, it may fail to hand off to your local installation properly and instead error. This commonly results in errors such as:
|
||||
|
||||
- `Could not find Nx modules in this workspace.`
|
||||
- `The current directory isn't part of an Nx workspace.`
|
||||
|
||||
If you find yourself in this position, you will need to update your global install of Nx.
|
||||
|
||||
In most cases, you can update a globally installed npm package by rerunning the command you used to install it, as described [above](#installing-nx-globally)
|
||||
|
||||
If you cannot remember which package manager you installed Nx globally with or are still encountering issues, you can locate other installs of Nx with these commands:
|
||||
|
||||
{% tabs %}
|
||||
{% tab label="npm" %}
|
||||
|
||||
```shell
|
||||
npm list --global nx
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="yarn" %}
|
||||
|
||||
```shell
|
||||
yarn global list nx
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="pnpm" %}
|
||||
|
||||
```shell
|
||||
pnpm list --global nx
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% /tabs %}
|
||||
|
||||
{% callout type="note" title="Older Global Installations" %}
|
||||
|
||||
In prior versions, Nx could be installed globally via `@nrwl/cli` or `@nrwl/tao`. If you are seeing these warnings but cannot find other global installations of Nx via the above commands, you should look for these packages as well. In general, you should remove these and install the latest version of `nx` instead.
|
||||
|
||||
{% /callout %}
|
||||
|
||||
You can then remove the extra global installations by running the following commands for the duplicate installations:
|
||||
|
||||
{% tabs %}
|
||||
{% tab label="npm" %}
|
||||
|
||||
```shell
|
||||
npm rm --global nx @nrwl/cli @nrwl/tao
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="yarn" %}
|
||||
|
||||
```shell
|
||||
yarn global remove nx @nrwl/cli @nrwl/tao
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="pnpm" %}
|
||||
|
||||
```shell
|
||||
pnpm rm --global nx @nrwl/cli @nrwl/tao
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% /tabs %}
|
||||
|
||||
Finally, to complete your global installation update, simply reinstall it as described [above](#installing-nx-globally).
|
||||
@ -155,6 +155,9 @@
|
||||
- [Tag in Multiple Dimensions](/recipes/enforce-module-boundaries/tag-multiple-dimensions)
|
||||
- [Ban External Imports](/recipes/enforce-module-boundaries/ban-external-imports)
|
||||
- [Tags Allow List](/recipes/enforce-module-boundaries/tags-allow-list)
|
||||
- [Installation](/recipes/installation)
|
||||
- [Install Nx in a Non-Javascript Repo](/recipes/installation/install-non-javascript)
|
||||
- [Update Your Global Nx Installation](/recipes/installation/update-global-installation)
|
||||
- [Tips and tricks](/recipes/tips-n-tricks)
|
||||
- [Add a Package-based Project in an Integrated Repo](/recipes/tips-n-tricks/package-based-in-integrated)
|
||||
- [Add an Integrated Project in a Package-based Repo](/recipes/tips-n-tricks/integrated-in-package-based)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user