| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b8d830b commit 323a1f3
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -51,6 +51,18 @@ symlink_bin_script() { | |||
| 51 | 51 | cd "$oldpwd" | |
| 52 | 52 | } | |
| 53 | 53 | ||
| 54 | + command_exists() { | ||
| 55 | + if [ ! "$1" ]; then return 1; fi | ||
| 56 | + command -v "$@" > /dev/null | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + is_root() { | ||
| 60 | + if command_exists id && [ "$(id -u)" = 0 ]; then | ||
| 61 | + return 0 | ||
| 62 | + fi | ||
| 63 | + return 1 | ||
| 64 | + } | ||
| 65 | + | ||
| 54 | 66 | OS="$(os)" | |
| 55 | 67 | ||
| 56 | 68 | main() { | |
@@ -75,17 +87,20 @@ main() { | |||
| 75 | 87 | exit 1 | |
| 76 | 88 | fi | |
| 77 | 89 | ||
| 78 | - case "${npm_config_user_agent-}" in npm*) | ||
| 79 | - # We are running under npm. | ||
| 80 | - if [ "${npm_config_unsafe_perm-}" != "true" ]; then | ||
| 81 | - echo "Please pass --unsafe-perm to npm to install code-server" | ||
| 82 | - echo "Otherwise the postinstall script does not have permissions to run" | ||
| 83 | - echo "See https://docs.npmjs.com/misc/config#unsafe-perm" | ||
| 84 | - echo "See https://stackoverflow.com/questions/49084929/npm-sudo-global-installation-unsafe-perm" | ||
| 85 | - exit 1 | ||
| 86 | - fi | ||
| 87 | - ;; | ||
| 88 | - esac | ||
| 90 | + # Under npm, if we are running as root, we need --unsafe-perm otherwise | ||
| 91 | + # post-install scripts will not have sufficient permissions to do their thing. | ||
| 92 | + if is_root; then | ||
| 93 | + case "${npm_config_user_agent-}" in npm*) | ||
| 94 | + if [ "${npm_config_unsafe_perm-}" != "true" ]; then | ||
| 95 | + echo "Please pass --unsafe-perm to npm to install code-server" | ||
| 96 | + echo "Otherwise post-install scripts will not have permissions to run" | ||
| 97 | + echo "See https://docs.npmjs.com/misc/config#unsafe-perm" | ||
| 98 | + echo "See https://stackoverflow.com/questions/49084929/npm-sudo-global-installation-unsafe-perm" | ||
| 99 | + exit 1 | ||
| 100 | + fi | ||
| 101 | + ;; | ||
| 102 | + esac | ||
| 103 | + fi | ||
| 89 | 104 | ||
| 90 | 105 | if ! vscode_install; then | |
| 91 | 106 | echo "You may not have the required dependencies to build the native modules." | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,7 +18,7 @@ nvm install 18 | |||
| 18 | 18 | nvm use 18 | |
| 19 | 19 | ``` | |
| 20 | 20 | ||
| 21 | - 8. Install code-server globally on device with: `npm install --global code-server --unsafe-perm` | ||
| 21 | + 8. Install code-server globally on device with: `npm install --global code-server` | ||
| 22 | 22 | 9. Run code-server with `code-server` | |
| 23 | 23 | 10. Access on localhost:8080 in your browser | |
| 24 | 24 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -92,7 +92,7 @@ Installing code-server requires all of the [prerequisites for VS Code developmen | |||
| 92 | 92 | Next, install code-server with: | |
| 93 | 93 | ||
| 94 | 94 | ```bash | |
| 95 | - npm install --global code-server --unsafe-perm | ||
| 95 | + npm install --global code-server | ||
| 96 | 96 | code-server | |
| 97 | 97 | # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml | |
| 98 | 98 | ``` | |
@@ -112,7 +112,7 @@ For help and additional troubleshooting, see [#1397](https://github.com/coder/co | |||
| 112 | 112 | After adding the dependencies for your OS, install the code-server package globally: | |
| 113 | 113 | ||
| 114 | 114 | ```bash | |
| 115 | - npm install --global code-server --unsafe-perm | ||
| 115 | + npm install --global code-server | ||
| 116 | 116 | code-server | |
| 117 | 117 | # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml | |
| 118 | 118 | ``` | |
@@ -144,8 +144,8 @@ To debug installation issues, install with `npm`: | |||
| 144 | 144 | ||
| 145 | 145 | ```shell | |
| 146 | 146 | # Uninstall | |
| 147 | - npm uninstall --global --unsafe-perm code-server > /dev/null 2>&1 | ||
| 147 | + npm uninstall --global code-server > /dev/null 2>&1 | ||
| 148 | 148 | ||
| 149 | 149 | # Install with logging | |
| 150 | - npm install --loglevel verbose --global --unsafe-perm code-server | ||
| 150 | + npm install --loglevel verbose --global code-server | ||
| 151 | 151 | ``` | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -70,7 +70,7 @@ code-server --auth none | |||
| 70 | 70 | 7. If already installed then use the following command for upgradation. | |
| 71 | 71 | ||
| 72 | 72 | ``` | |
| 73 | - npm update --global code-server --unsafe-perm | ||
| 73 | + npm update --global code-server | ||
| 74 | 74 | ``` | |
| 75 | 75 | ||
| 76 | 76 | ## Upgrade | |
| Back | FazBrowse Home | New Git URL |
0 commit comments