From 00b66a9cf71965ff223ed4333d5a750fa40a17bc Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Mon, 5 Dec 2016 21:40:50 -0400 Subject: [PATCH] chore: use `pushd`/`popd` instead of `--prefix` on `dependencies-npm.sh` (#941) We currently use the `--prefix` option in `dependencies-npm.sh` to install dependencies in another directory, however that function causes ENOSELF to be thrown on Windows under Msys. As a solution, we take the same `pushd`/`popd` approach as we do in `dependencies-bower.sh`. Signed-off-by: Juan Cruz Viotti --- scripts/unix/dependencies-npm.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/scripts/unix/dependencies-npm.sh b/scripts/unix/dependencies-npm.sh index 6480e084..aa2ce497 100755 --- a/scripts/unix/dependencies-npm.sh +++ b/scripts/unix/dependencies-npm.sh @@ -98,23 +98,18 @@ fi if [ -n "$ARGV_PREFIX" ]; then mkdir -p "$ARGV_PREFIX" - INSTALL_OPTS="$INSTALL_OPTS --prefix=$ARGV_PREFIX" ln -s "$PWD/package.json" "$ARGV_PREFIX/package.json" if [ -f "$PWD/npm-shrinkwrap.json" ]; then ln -s "$PWD/npm-shrinkwrap.json" "$ARGV_PREFIX/npm-shrinkwrap.json" fi -fi -npm install $INSTALL_OPTS + pushd "$ARGV_PREFIX" + npm install $INSTALL_OPTS + popd -if [ -n "$ARGV_PREFIX" ]; then rm -f "$ARGV_PREFIX/package.json" rm -f "$ARGV_PREFIX/npm-shrinkwrap.json" - - # Using `--prefix` might cause npm to create an empty `etc` directory - if [ ! "$(ls -A "$ARGV_PREFIX/etc")" ]; then - rmdir "$ARGV_PREFIX/etc" - fi - +else + npm install $INSTALL_OPTS fi