Perfect! Let’s set up npm on Termux/Linux so you can install global packages without sudo and get real-time script output. This is a clean, “upgraded” setup.
---
Step 1: Create a global npm directory
mkdir ~/.npm-global
This will be the new location for all global npm packages.
---
Step 2: Configure npm to use this directory
npm config set prefix '~/.npm-global'
npm config set foreground-scripts true
prefix → tells npm where to install global packages.
foreground-scripts → ensures scripts run in the foreground so you can see output immediately.
---
Step 3: Add the npm global bin to your PATH
Edit your shell profile (~/.bashrc or ~/.zshrc) and add:
export PATH="$HOME/.npm-global/bin:$PATH"
Then reload your shell:
source ~/.bashrc # or source ~/.zshrc
Check if it worked:
echo $PATH
npm -v
---
Step 4: Test installing a global package
npm install -g nodemon
nodemon -v
Should install without sudo.
Should be executable immediately from any terminal session.
---
✅ Bonus: You now have a fully user-level npm setup. No sudo needed, no permissions errors, and lifecycle scripts run in the foreground.
Certainly, here's a step-by-step guide to finding your ISP gateway: Step 1: Check your Router or Modem - Physically inspect your router or modem. - Look for a label or sticker that contains information about your device. - Search for details such as the default gateway IP address. Step 2: Use the Command Prompt or Terminal - On Windows: Press the Windows key, type "cmd," and press Enter to open the Command Prompt. - On Mac: Open the Terminal from the Applications folder or by searching for it. - On Linux: Open the Terminal from your applications menu. - Type "ipconfig" on Windows or "ifconfig" on Mac and Linux and press Enter. - In the output, locate the "Default Gateway" information. This is your ISP gateway's IP address. Step 3: Access your Router's Web Interface - Open a web browser (e.g., Chrome, Firefox, or Safari). - In the address bar, enter the default gateway IP address you found in Step 2. Typically, it's something like...
Comments
Post a Comment