Last active
April 3, 2023 08:17
-
-
Save kevinastone/8790717 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
BASE_DIR=${TMPDIR:-/var/tmp} | |
ORIG_DIR=$PWD | |
HASH_CMD="md5sum" | |
DIR_NAME=`echo $PWD | $HASH_CMD | cut -f1 -d " "` | |
TMP_DIR=$BASE_DIR/$DIR_NAME | |
mkdir -p $TMP_DIR | |
pushd $TMP_DIR | |
ln -sf $ORIG_DIR/package.json | |
npm $1 | |
# Can't use archive mode cause of the permissions | |
rsync --recursive --links --times node_modules $ORIG_DIR | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Amazing script.
Vagrant 1.9.1, NPM 3.10.10
I put this in my folder.
And run such as "sudo npm install --save-dev mocha".
Then it works.