Skip to content

Commit

Permalink
mgr/dashboard: update nodejs to 18.17.0
Browse files Browse the repository at this point in the history
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 <nia@redhat.com>
  • Loading branch information
nizamial09 committed Sep 22, 2023
1 parent 7f8f232 commit 47f49e5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions doc/dev/developer_guide/dash-devel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ The build process is based on `Node.js <https://nodejs.org/>`_ 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``
Expand Down
2 changes: 1 addition & 1 deletion make-dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/pybind/mgr/dashboard/frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -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
Expand Down

0 comments on commit 47f49e5

Please sign in to comment.