mirror of
https://github.com/coder/code-server.git
synced 2026-09-02 08:30:17 +02:00
Remove --unsafe-perm flag from install scripts (#7953)
npm 12 rejects unknown CLI flags, so the npm install path crashes with EUNKNOWNCONFIG before installing. The flag has been a no-op since npm 7; remove it from install.sh and the postinstall guard.
This commit is contained in:
@@ -76,20 +76,6 @@ 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*)
|
||||
if [ "${npm_config_unsafe_perm-}" != "true" ]; then
|
||||
echo "Please pass --unsafe-perm to npm to install code-server"
|
||||
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."
|
||||
@@ -110,7 +96,7 @@ install_with_yarn_or_npm() {
|
||||
# end-user we want to keep using whatever package manager is in use.
|
||||
case "${npm_config_user_agent-}" in
|
||||
npm*)
|
||||
if ! npm install --unsafe-perm --omit=dev; then
|
||||
if ! npm install --omit=dev; then
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
|
||||
@@ -436,7 +436,7 @@ install_npm() {
|
||||
fi
|
||||
echoh "Installing with npm."
|
||||
echoh
|
||||
"$sh_c" "$NPM_PATH" install -g "code-server@$VERSION" --unsafe-perm
|
||||
"$sh_c" "$NPM_PATH" install -g "code-server@$VERSION"
|
||||
NPM_BIN_DIR="\$($NPM_PATH bin -g)" echo_npm_postinstall
|
||||
return
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user