Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove existing npm folder before copying activated version #470

Merged
merged 1 commit into from
Jun 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion bin/n
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,14 @@ activate() {
check_current_version
if test "$version" != "$active"; then
local dir=$BASE_VERSIONS_DIR/$version
for subdir in bin lib include share; do
# Remove old npm to avoid potential issues with simple overwrite.
if test -d "$dir/lib/node_modules/npm"; then
if test -d "$N_PREFIX/lib/node_modules/npm"; then
rm -rf "$N_PREFIX/lib/node_modules/npm"
fi
fi
# Copy (lib before bin to avoid error messages on Darwin when cp over dangling link)
for subdir in lib bin include share; do
if test -L "$N_PREFIX/$subdir"; then
find "$dir/$subdir" -mindepth 1 -maxdepth 1 -exec cp -fR "{}" "$N_PREFIX/$subdir" \;
else
Expand Down