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:
		| @@ -1,5 +1,12 @@ | ||||
| # Changelog | ||||
|  | ||||
| ## 2025-03-26 - 2.6.3 - fix(setup) | ||||
| Update setup script to install only net-snmp dependency and create a minimal package-lock.json for better dependency control. | ||||
|  | ||||
| - Removed full production dependency install in favor of installing only net-snmp@3.20.0 | ||||
| - Added verification step to confirm net-snmp installation | ||||
| - Generate a minimal package-lock.json if one does not exist | ||||
|  | ||||
| ## 2025-03-26 - 2.6.2 - fix(setup/readme) | ||||
| Improve force update instructions and dependency installation process in setup.sh and readme.md | ||||
|  | ||||
|   | ||||
							
								
								
									
										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 | ||||
|   | ||||
| @@ -3,6 +3,6 @@ | ||||
|  */ | ||||
| export const commitinfo = { | ||||
|   name: '@serve.zone/nupst', | ||||
|   version: '2.6.2', | ||||
|   version: '2.6.3', | ||||
|   description: 'Node.js UPS Shutdown Tool for SNMP-enabled UPS devices' | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user