Install Node to Python image

This guide explains how to set up Node.js and npm in a python container on seenode, including creating a setup script and configuring the build command.

1. Create a node installation bash file

In your git repository, create a new file called install_node.sh with the following content

install_node.sh
#!/bin/bash
set -e

# Update package lists and install curl
apt-get update && apt-get install -y curl

# Install Node.js and npm (Node.js v20)
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs

# Upgrade npm to the latest version
npm install -g npm@latest

# Clean up to reduce image size
apt-get clean && rm -rf /var/lib/apt/lists/*

# Display installed versions
node --version
npm --version

2. Edit build command on seenode platform

For instance if you need to install node and then python packages from requirements.txt file, use this build command.

bash install_node.sh && pip install -r requirements.txt

Last updated