From 54c06c674814bc00518e6229192fbb16e21a9c57 Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Mon, 28 Aug 2023 20:15:06 +0530 Subject: [PATCH] mgr/dashboard: update nodejs to 18.17.0 the latest npm doesn't support setting python as a config like `npm config set python3` instead it needs to be either set in the node-gyp explicitly using the node-gyp command or through an environment variable. Since we are calling the node-gyp through npm, we need to set the environment variable which is documented here: https://github.com/nodejs/node-gyp?tab=readme-ov-file#configuring-python-dependency Accordingly the CMakeLists.txt for dashboard is adapted Fixes: https://tracker.ceph.com/issues/62844 Signed-off-by: Nizamudeen A (cherry picked from commit 47f49e5b1ae2e5bf7aad5df23d877ae5df00210c) --- doc/dev/developer_guide/dash-devel.rst | 4 ++-- make-dist | 2 +- src/pybind/mgr/dashboard/frontend/CMakeLists.txt | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/dev/developer_guide/dash-devel.rst b/doc/dev/developer_guide/dash-devel.rst index cbeead788eb69..1277cecc552f7 100644 --- a/doc/dev/developer_guide/dash-devel.rst +++ b/doc/dev/developer_guide/dash-devel.rst @@ -214,8 +214,8 @@ The build process is based on `Node.js `_ and requires the Prerequisites ~~~~~~~~~~~~~ - * Node 16.20.0 or higher - * NPM 6.14.9 or higher + * Node 18.17.0 or higher + * NPM 9.6.7 or higher nodeenv: During Ceph's build we create a virtualenv with ``node`` and ``npm`` diff --git a/make-dist b/make-dist index f38e1365991ae..721e9128c45ce 100755 --- a/make-dist +++ b/make-dist @@ -132,7 +132,7 @@ build_dashboard_frontend() { $CURR_DIR/src/tools/setup-virtualenv.sh $TEMP_DIR $TEMP_DIR/bin/pip install nodeenv - $TEMP_DIR/bin/nodeenv --verbose -p --node=16.20.1 + $TEMP_DIR/bin/nodeenv --verbose -p --node=18.17.0 cd src/pybind/mgr/dashboard/frontend . $TEMP_DIR/bin/activate diff --git a/src/pybind/mgr/dashboard/frontend/CMakeLists.txt b/src/pybind/mgr/dashboard/frontend/CMakeLists.txt index 78ba7620d589b..2527ef23e85e5 100644 --- a/src/pybind/mgr/dashboard/frontend/CMakeLists.txt +++ b/src/pybind/mgr/dashboard/frontend/CMakeLists.txt @@ -40,6 +40,7 @@ function(add_npm_options) npm config set ${key} ${value} --userconfig ${NC_NODEENV_DIR}/.npmrc && deactivate) endforeach() + set(npm_config_python ${MGR_PYTHON_EXECUTABLE}) add_custom_target(${NC_TARGET} ${commands} DEPENDS ${NC_NODEENV_DIR}/bin/npm @@ -63,7 +64,7 @@ else(WITH_SYSTEM_NPM) OUTPUT "${mgr-dashboard-nodeenv-dir}/bin/npm" COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python=${MGR_PYTHON_EXECUTABLE} ${mgr-dashboard-nodeenv-dir} COMMAND ${mgr-dashboard-nodeenv-dir}/bin/pip install nodeenv - COMMAND ${mgr-dashboard-nodeenv-dir}/bin/nodeenv --verbose ${node_mirror_opt} -p --node=16.20.1 + COMMAND ${mgr-dashboard-nodeenv-dir}/bin/nodeenv --verbose ${node_mirror_opt} -p --node=18.17.0 COMMAND mkdir ${mgr-dashboard-nodeenv-dir}/.npm WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "dashboard nodeenv is being installed") @@ -73,7 +74,6 @@ else(WITH_SYSTEM_NPM) add_npm_options( NODEENV_DIR ${mgr-dashboard-nodeenv-dir} TARGET mgr-dashboard-nodeenv - OPTION python=${MGR_PYTHON_EXECUTABLE} OPTION cache=${mgr-dashboard-nodeenv-dir}/.npm ${npm_registry_opts}) add_custom_target(mgr-dashboard-frontend-deps