Skip to content

Commit

Permalink
fix(node): redirect npm errors to stdout (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice authored Jun 10, 2022
1 parent 0840cbc commit e28a2b4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/usr/local/bin/install-npm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ case "$TOOL_NAME" in
mkdir -p "${temp_folder}"

echo "Installing npm tool ${TOOL_NAME} v${TOOL_VERSION}"
npm install "${TOOL_NAME}@${TOOL_VERSION}" --global --unsafe --no-audit --no-fund --cache "${temp_folder}"
npm install "${TOOL_NAME}@${TOOL_VERSION}" --global --unsafe --no-audit --no-fund --cache "${temp_folder}" 2>&1

# Clean download cache
npm cache clean --force
Expand Down
2 changes: 1 addition & 1 deletion src/usr/local/buildpack/tools/node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ if [[ -z "${tool_path}" ]]; then

if [[ ${MAJOR} -lt 15 ]]; then
# update to latest node-gyp to fully support python3
$npm explore npm --global --prefix "$tool_path" -- "$npm" install node-gyp@latest --no-audit --cache "${NPM_CONFIG_CACHE}"
$npm explore npm --global --prefix "$tool_path" -- "$npm" install node-gyp@latest --no-audit --cache "${NPM_CONFIG_CACHE}" 2>&1
fi

npm_clean
Expand Down
2 changes: 1 addition & 1 deletion src/usr/local/buildpack/tools/yarn-slim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tool_path=$(find_versioned_tool_path)
if [[ -z "${tool_path}" ]]; then
npm_init
tool_path="$(create_versioned_tool_path)"
npm install "yarn@${TOOL_VERSION}" --global --no-audit --prefix "$tool_path" --cache "${NPM_CONFIG_CACHE}"
npm install "yarn@${TOOL_VERSION}" --global --no-audit --prefix "$tool_path" --cache "${NPM_CONFIG_CACHE}" 2>&1
npm_clean

# patch yarn
Expand Down
4 changes: 2 additions & 2 deletions src/usr/local/buildpack/utils/node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ function npm_install () {
local tool_path=
tool_path="$(create_versioned_tool_path)"

npm install "${TOOL_NAME}@${TOOL_VERSION}" --global --no-audit --prefix "$tool_path" --cache "${NPM_CONFIG_CACHE}"
npm install "${TOOL_NAME}@${TOOL_VERSION}" --global --no-audit --prefix "$tool_path" --cache "${NPM_CONFIG_CACHE}" 2>&1

if [[ "${TOOL_NAME}" == "npm" && ${MAJOR} -lt 7 ]]; then
# update to latest node-gyp to fully support python3
"$tool_path/bin/npm" explore npm --global --prefix "$tool_path" -- npm install node-gyp@latest --no-audit --cache "${NPM_CONFIG_CACHE}"
"$tool_path/bin/npm" explore npm --global --prefix "$tool_path" -- npm install node-gyp@latest --no-audit --cache "${NPM_CONFIG_CACHE}" 2>&1
fi
}

Expand Down

0 comments on commit e28a2b4

Please sign in to comment.