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"
|
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)"
|
OS="$(os)"
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
@ -75,17 +87,20 @@ main() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "${npm_config_user_agent-}" in npm*)
|
# Under npm, if we are running as root, we need --unsafe-perm otherwise
|
||||||
# We are running under npm.
|
# post-install scripts will not have sufficient permissions to do their thing.
|
||||||
if [ "${npm_config_unsafe_perm-}" != "true" ]; then
|
if is_root; then
|
||||||
echo "Please pass --unsafe-perm to npm to install code-server"
|
case "${npm_config_user_agent-}" in npm*)
|
||||||
echo "Otherwise the postinstall script does not have permissions to run"
|
if [ "${npm_config_unsafe_perm-}" != "true" ]; then
|
||||||
echo "See https://docs.npmjs.com/misc/config#unsafe-perm"
|
echo "Please pass --unsafe-perm to npm to install code-server"
|
||||||
echo "See https://stackoverflow.com/questions/49084929/npm-sudo-global-installation-unsafe-perm"
|
echo "Otherwise post-install scripts will not have permissions to run"
|
||||||
exit 1
|
echo "See https://docs.npmjs.com/misc/config#unsafe-perm"
|
||||||
fi
|
echo "See https://stackoverflow.com/questions/49084929/npm-sudo-global-installation-unsafe-perm"
|
||||||
;;
|
exit 1
|
||||||
esac
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
if ! vscode_install; then
|
if ! vscode_install; then
|
||||||
echo "You may not have the required dependencies to build the native modules."
|
echo "You may not have the required dependencies to build the native modules."
|
||||||
|
@ -18,7 +18,7 @@ nvm install 18
|
|||||||
nvm use 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`
|
9. Run code-server with `code-server`
|
||||||
10. Access on localhost:8080 in your browser
|
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:
|
Next, install code-server with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install --global code-server --unsafe-perm
|
npm install --global code-server
|
||||||
code-server
|
code-server
|
||||||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
# 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:
|
After adding the dependencies for your OS, install the code-server package globally:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install --global code-server --unsafe-perm
|
npm install --global code-server
|
||||||
code-server
|
code-server
|
||||||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
# 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
|
```shell
|
||||||
# Uninstall
|
# Uninstall
|
||||||
npm uninstall --global --unsafe-perm code-server > /dev/null 2>&1
|
npm uninstall --global code-server > /dev/null 2>&1
|
||||||
|
|
||||||
# Install with logging
|
# 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.
|
7. If already installed then use the following command for upgradation.
|
||||||
|
|
||||||
```
|
```
|
||||||
npm update --global code-server --unsafe-perm
|
npm update --global code-server
|
||||||
```
|
```
|
||||||
|
|
||||||
## Upgrade
|
## Upgrade
|
||||||
|
Reference in New Issue
Block a user