Created
December 8, 2023 20:42
-
-
Save dotysan/b38e8b5760218d2c99d88f49cf37291a to your computer and use it in GitHub Desktop.
Install Node.js in a Python virtual environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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