Skip to content

Instantly share code, notes, and snippets.

@dotysan
Created December 8, 2023 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotysan/b38e8b5760218d2c99d88f49cf37291a to your computer and use it in GitHub Desktop.
Save dotysan/b38e8b5760218d2c99d88f49cf37291a to your computer and use it in GitHub Desktop.
Install Node.js in a Python virtual environment
SHELL:= /usr/bin/env bash
PY:= python3.12
vb:= .venv/bin/
.PHONY: clean
$(vb)npm: $(vb)nodeenv
source $(vb)activate && \
nodeenv --python-virtualenv --node=lts && \
touch -r $(vb)activate.csh $(vb)activate && \
npm install --global npm
# Note that nodeenv --python-virtualenv above modifies activate,
# so we must reset the mtime to prevent successive runs of make
# from re-installing everything below.
$(vb)nodeenv: $(vb)wheel
source $(vb)activate && \
pip install nodeenv
$(vb)wheel: $(vb)activate
source $(vb)activate && \
pip install --upgrade pip setuptools wheel
$(vb)activate:
$(PY) -m venv .venv
clean:
rm -fr .venv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment