mirror of https://github.com/coder/code-server.git
Only require unsafe-perm if you are root
Remove it from the docs, as the error message should be sufficient and it seems weird to recommend unsafe-perm by default.
This commit is contained in:
parent
b8d830b826
commit
323a1f3234
|
@ -51,6 +51,18 @@ symlink_bin_script() {
|
|||
cd "$oldpwd"
|
||||
}
|
||||
|
||||
command_exists() {
|
||||
if [ ! "$1" ]; then return 1; fi
|
||||
command -v "$@" > /dev/null
|
||||
}
|
||||
|
||||
is_root() {
|
||||
if command_exists id && [ "$(id -u)" = 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
OS="$(os)"
|
||||
|
||||
main() {
|
||||
|
@ -75,17 +87,20 @@ main() {
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Under npm, if we are running as root, we need --unsafe-perm otherwise
|
||||
# post-install scripts will not have sufficient permissions to do their thing.
|
||||
if is_root; then
|
||||
case "${npm_config_user_agent-}" in npm*)
|
||||
# We are running under npm.
|
||||
if [ "${npm_config_unsafe_perm-}" != "true" ]; then
|
||||
echo "Please pass --unsafe-perm to npm to install code-server"
|
||||
echo "Otherwise the postinstall script does not have permissions to run"
|
||||
echo "Otherwise post-install scripts will not have permissions to run"
|
||||
echo "See https://docs.npmjs.com/misc/config#unsafe-perm"
|
||||
echo "See https://stackoverflow.com/questions/49084929/npm-sudo-global-installation-unsafe-perm"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if ! vscode_install; then
|
||||
echo "You may not have the required dependencies to build the native modules."
|
||||
|
|
|
@ -18,7 +18,7 @@ nvm install 18
|
|||
nvm use 18
|
||||
```
|
||||
|
||||
8. Install code-server globally on device with: `npm install --global code-server --unsafe-perm`
|
||||
8. Install code-server globally on device with: `npm install --global code-server`
|
||||
9. Run code-server with `code-server`
|
||||
10. Access on localhost:8080 in your browser
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ Installing code-server requires all of the [prerequisites for VS Code developmen
|
|||
Next, install code-server with:
|
||||
|
||||
```bash
|
||||
npm install --global code-server --unsafe-perm
|
||||
npm install --global code-server
|
||||
code-server
|
||||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
||||
```
|
||||
|
@ -112,7 +112,7 @@ For help and additional troubleshooting, see [#1397](https://github.com/coder/co
|
|||
After adding the dependencies for your OS, install the code-server package globally:
|
||||
|
||||
```bash
|
||||
npm install --global code-server --unsafe-perm
|
||||
npm install --global code-server
|
||||
code-server
|
||||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
||||
```
|
||||
|
@ -144,8 +144,8 @@ To debug installation issues, install with `npm`:
|
|||
|
||||
```shell
|
||||
# Uninstall
|
||||
npm uninstall --global --unsafe-perm code-server > /dev/null 2>&1
|
||||
npm uninstall --global code-server > /dev/null 2>&1
|
||||
|
||||
# Install with logging
|
||||
npm install --loglevel verbose --global --unsafe-perm code-server
|
||||
npm install --loglevel verbose --global code-server
|
||||
```
|
||||
|
|
|
@ -70,7 +70,7 @@ code-server --auth none
|
|||
7. If already installed then use the following command for upgradation.
|
||||
|
||||
```
|
||||
npm update --global code-server --unsafe-perm
|
||||
npm update --global code-server
|
||||
```
|
||||
|
||||
## Upgrade
|
||||
|
|
Loading…
Reference in New Issue