fix(setup/readme): Improve force update instructions and dependency installation process in setup.sh and readme.md

This commit is contained in:
2025-03-26 13:54:49 +00:00
parent 47ef918128
commit 3e6b883b38
4 changed files with 22 additions and 14 deletions

View File

@@ -244,27 +244,24 @@ NODE_BIN_DIR="$SCRIPT_DIR/vendor/$NODE_DIR/bin"
OLD_PATH="$PATH"
export PATH="$NODE_BIN_DIR:$PATH"
# Remove existing node_modules directory
echo "Removing existing node_modules directory..."
rm -rf "$SCRIPT_DIR/node_modules"
# Install production dependencies
echo "Installing production dependencies..."
echo "Using Node.js binary from: $NODE_BIN_DIR"
echo "Node version: $(node --version)"
echo "NPM version: $(npm --version)"
npm --prefix "$SCRIPT_DIR" ci --only=production --no-audit --no-fund
npm --prefix "$SCRIPT_DIR" install --omit=dev --no-audit --no-fund
if [ $? -ne 0 ]; then
echo "Warning: Failed to install dependencies with 'npm ci'. Trying 'npm install'..."
npm --prefix "$SCRIPT_DIR" install --only=production --no-audit --no-fund
if [ $? -ne 0 ]; then
echo "Error: Failed to install dependencies. NUPST may not function correctly."
echo "You can try to install dependencies manually by running:"
echo "cd $SCRIPT_DIR && npm install --only=production"
else
echo "Dependencies installed successfully with 'npm install'."
fi
echo "Error: Failed to install dependencies. NUPST may not function correctly."
echo "You can try to install dependencies manually by running:"
echo "cd $SCRIPT_DIR && npm install --omit=dev"
else
echo "Dependencies installed successfully with 'npm ci'."
echo "Dependencies installed successfully."
fi
# Restore the original PATH