0
0
mirror of https://github.com/tj/n.git synced 2024-11-21 18:48:57 +01:00

Expand permissions issues coverage (#790)

This commit is contained in:
John Gee 2024-01-20 09:56:52 +13:00 committed by GitHub
parent ea87a51027
commit 127506d021
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,10 +37,15 @@ If you already have Node.js installed, an easy way to install `n` is using `npm`
npm install -g n
The `n` command downloads and installs to `/usr/local` by default, but you may override this location by defining `N_PREFIX`.
The default root location used when running `n` is `/usr/local` where a normal user does not have write permission. You may strike the same sort of permission error when using npm to install global modules, like the above command. You have three main options:
1) change the ownership of the relevant directories to yourself (see below)
2) tell `n` to use a custom location where you do have write permissions (see `N_PREFIX`)
3) put `sudo` in front of the command to run it as super user
`n` caches Node.js versions in subdirectory `n/versions`. The _active_ Node.js version is installed in subdirectories `bin`, `include`, `lib`, and `share`.
To avoid requiring `sudo` for `n` and `npm` global installs, it is suggested you either install to your home directory using `N_PREFIX`, or take ownership of the system directories:
To take ownership of the system directories (option 1):
# make cache folder (if missing) and take ownership
sudo mkdir -p /usr/local/n