I’m to the point where I have this in a makefile:
monkeynpm: rm -rf node_modules && \ docker run -it --rm -v $(pwd):/usr/src/app -w /usr/src/app mhart/alpine-node:latest sh -c "apk add --no-cache --virtual .npm-deps git python make gcc linux-headers alpine-sdk && mkdir ../npm-install && cp package.json ../npm-install/package.json && cd ../npm-install && npm install && tar -cf ../app/npm.tar node_modules" && \ tar -zxf npm.tar && \ rm -rf npm.tar
Essentially clears the node_modules folder, spools up a container that copies the package.json to a directory elsewhere in the container’s normal file system, does an npm install, tarballs the resulting node_modules folder, copies the tar back to the working directory (which is my source code directory) and then in OS X untars/removes the result.
Dirty hack but desperate times…