fix(setup): Update setup script to install only net-snmp dependency and create a minimal package-lock.json for better dependency control.
This commit is contained in:
38
setup.sh
38
setup.sh
@@ -248,20 +248,44 @@ export PATH="$NODE_BIN_DIR:$PATH"
|
||||
echo "Removing existing node_modules directory..."
|
||||
rm -rf "$SCRIPT_DIR/node_modules"
|
||||
|
||||
# Install production dependencies
|
||||
echo "Installing production dependencies..."
|
||||
# Install ONLY the net-snmp production dependency
|
||||
echo "Installing ONLY net-snmp production dependency..."
|
||||
echo "Using Node.js binary from: $NODE_BIN_DIR"
|
||||
echo "Node version: $(node --version)"
|
||||
echo "NPM version: $(npm --version)"
|
||||
|
||||
npm --prefix "$SCRIPT_DIR" install --omit=dev --no-audit --no-fund
|
||||
# Install just net-snmp directly, don't rely on package.json
|
||||
npm --prefix "$SCRIPT_DIR" install --no-save net-snmp@3.20.0 --no-audit --no-fund
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Failed to install dependencies. NUPST may not function correctly."
|
||||
# Verify only net-snmp is installed
|
||||
echo "Verifying only net-snmp is installed in node_modules..."
|
||||
find "$SCRIPT_DIR/node_modules" -maxdepth 1 -type d | sort
|
||||
|
||||
INSTALL_STATUS=$?
|
||||
if [ $INSTALL_STATUS -ne 0 ]; then
|
||||
echo "Error: Failed to install net-snmp dependency. NUPST may not function correctly."
|
||||
echo "You can try to install dependencies manually by running:"
|
||||
echo "cd $SCRIPT_DIR && npm install --omit=dev"
|
||||
echo "cd $SCRIPT_DIR && npm install net-snmp@3.20.0"
|
||||
else
|
||||
echo "Dependencies installed successfully."
|
||||
echo "net-snmp dependency installed successfully."
|
||||
|
||||
# Create minimal package-lock.json if it doesn't exist
|
||||
if [ ! -f "$SCRIPT_DIR/package-lock.json" ]; then
|
||||
echo "Creating minimal package-lock.json..."
|
||||
echo '{
|
||||
"name": "@serve.zone/nupst",
|
||||
"version": "2.6.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"net-snmp": "3.20.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}' > "$SCRIPT_DIR/package-lock.json"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Restore the original PATH
|
||||
|
Reference in New Issue
Block a user