aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamruddhi Khandale <skhandale@microsoft.com>2022-11-16 01:51:00 +0300
committerGitHub <noreply@github.com>2022-11-16 01:51:00 +0300
commit1e35500bda4b00fadc1b2881865ad3cffaa69ff8 (patch)
tree4c1ac0b61f6bef5999c97084352031a61eef8e7c
parentf9acb6aae1e520b0b61aaac9ab4ecb00dd497451 (diff)
Node: Fix bug - version set by Feature is not default (#294)
* Node:Fix bug version set by Feature is not default * node not supported for ubuntu:bionic
-rw-r--r--src/node/devcontainer-feature.json2
-rwxr-xr-xsrc/node/install.sh8
-rw-r--r--test/node/install_node_on_universal_image.sh11
-rw-r--r--test/node/scenarios.json9
4 files changed, 28 insertions, 2 deletions
diff --git a/src/node/devcontainer-feature.json b/src/node/devcontainer-feature.json
index 538ecb2..49d2160 100644
--- a/src/node/devcontainer-feature.json
+++ b/src/node/devcontainer-feature.json
@@ -1,6 +1,6 @@
{
"id": "node",
- "version": "1.1.1",
+ "version": "1.1.2",
"name": "Node.js (via nvm) and yarn",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/node",
"description": "Installs Node.js, nvm, yarn, and needed dependencies.",
diff --git a/src/node/install.sh b/src/node/install.sh
index f51306e..2f2e7aa 100755
--- a/src/node/install.sh
+++ b/src/node/install.sh
@@ -81,6 +81,12 @@ check_packages() {
# Ensure apt is in non-interactive to avoid prompts
export DEBIAN_FRONTEND=noninteractive
+. /etc/os-release
+if [[ "bionic" = *"${VERSION_CODENAME}"* ]]; then
+ echo "(!) Unsupported distribution version '${VERSION_CODENAME}'. Details: https://github.com/nodejs/node/issues/42351#issuecomment-1068424442"
+ exit 1
+fi
+
# Install dependencies
check_packages apt-transport-https curl ca-certificates tar gnupg2 dirmngr
@@ -152,7 +158,7 @@ if [ ! -d "${NVM_DIR}" ]; then
else
echo "NVM already installed."
if [ "${NODE_VERSION}" != "" ]; then
- su ${USERNAME} -c "umask 0002 && . $NVM_DIR/nvm.sh && nvm install ${NODE_VERSION}"
+ su ${USERNAME} -c "umask 0002 && . $NVM_DIR/nvm.sh && nvm install ${NODE_VERSION} && nvm alias default ${NODE_VERSION}"
fi
fi
diff --git a/test/node/install_node_on_universal_image.sh b/test/node/install_node_on_universal_image.sh
new file mode 100644
index 0000000..faca1eb
--- /dev/null
+++ b/test/node/install_node_on_universal_image.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+check "version_on_path" bash -c "node -v | grep 'v19.1.0'"
+
+# Report result
+reportResults
diff --git a/test/node/scenarios.json b/test/node/scenarios.json
index 1240e61..70e1051 100644
--- a/test/node/scenarios.json
+++ b/test/node/scenarios.json
@@ -25,5 +25,14 @@
"version": "none"
}
}
+ },
+ "install_node_on_universal_image": {
+ "image": "mcr.microsoft.com/devcontainers/universal",
+ "remoteUser": "codespace",
+ "features": {
+ "node": {
+ "version": "19.1.0"
+ }
+ }
}
} \ No newline at end of file