This is how you can detect existing Node.js and npm, or automatically install a temporary Node.js if none is already installed. About the only things needed are make, bash, curl and git, which are usually available on all development / CI machines. (I’m planning to work around the requirements for curl and git, so those won’t even be needed in the future.) Put this at the top of your Makefile:
|
1 2 3 |
SHELL := /bin/bash NODE_PATH = $(shell ./find-node-or-install) PATH := $(NODE_PATH):$(shell echo $$PATH) |
Then download the find-node-or-install script to the same directory:…