| Crates.io | vx-pm-npm |
| lib.rs | vx-pm-npm |
| version | 0.2.6 |
| created_at | 2025-06-15 04:13:07.54781+00 |
| updated_at | 2025-06-18 06:22:38.675659+00 |
| description | NPM package manager support for vx |
| homepage | https://github.com/loonghao/vx |
| repository | https://github.com/loonghao/vx |
| max_upload_size | |
| id | 1712894 |
| size | 81,126 |
NPM package manager support for the vx universal tool manager.
vx-pm-npm provides NPM (Node Package Manager) support for vx, enabling package management, script execution, and NPX functionality through the vx interface.
# Install packages
vx npm install
vx npm install express
vx npm install -g typescript
vx npm install --save-dev jest
# Uninstall packages
vx npm uninstall express
vx npm uninstall -g typescript
# Update packages
vx npm update
vx npm update express
vx npm outdated
# Initialize projects
vx npm init
vx npm init -y
vx npm init @scope/package
# Run scripts
vx npm run dev
vx npm run build
vx npm run test
vx npm start
# Information
vx npm list
vx npm list --depth=0
vx npm info express
vx npm view express versions
# Run packages without installing
vx npx create-react-app my-app
vx npx typescript --init
vx npx cowsay "Hello from vx!"
# Run specific versions
vx npx typescript@4.9.5 --version
vx npx -p typescript@latest tsc --version
# Execute local binaries
vx npx jest
vx npx eslint src/
# Registry management
vx npm config set registry https://registry.npmjs.org/
vx npm config get registry
vx npm config list
# Authentication
vx npm login
vx npm logout
vx npm whoami
# Publishing
vx npm publish
vx npm unpublish package@version
NPM support is automatically available when Node.js is installed through vx:
# Install Node.js (includes npm)
vx install node@18.17.0
# NPM is automatically available
vx npm --version
[tools]
node = "18.17.0" # NPM comes with Node.js
[npm]
registry = "https://registry.npmjs.org/"
cache_dir = "~/.npm"
prefix = "~/.npm-global"
[npm.settings]
registry = "https://registry.npmjs.org/"
cache = "~/.npm"
prefix = "~/.npm-global"
audit_level = "moderate"
fund = false
# Global .npmrc
registry=https://registry.npmjs.org/
cache=~/.npm
prefix=~/.npm-global
audit-level=moderate
fund=false
# Project .npmrc
registry=https://registry.npmjs.org/
save-exact=true
package-lock=true
{
"name": "my-project",
"version": "1.0.0",
"description": "My awesome project",
"main": "index.js",
"scripts": {
"start": "node index.js",
"dev": "nodemon index.js",
"build": "webpack --mode production",
"test": "jest"
},
"dependencies": {
"express": "^4.18.0"
},
"devDependencies": {
"jest": "^29.0.0",
"nodemon": "^3.0.0"
}
}
# Run package.json scripts
vx npm run start
vx npm run dev
vx npm run build
vx npm run test
# List available scripts
vx npm run
# Run with arguments
vx npm run test -- --watch
vx npm run build -- --env production
# Project scaffolding
vx npx create-react-app my-react-app
vx npx create-next-app my-next-app
vx npx @angular/cli new my-angular-app
# Development tools
vx npx typescript --init
vx npx eslint --init
vx npx prettier --write .
# One-time utilities
vx npx cowsay "Hello World"
vx npx http-server
vx npx json-server db.json
use vx_core::{PackageManager, ToolManager};
use vx_pm_npm::NpmPackageManager;
let npm = NpmPackageManager::new();
let manager = ToolManager::new();
// Install packages
npm.install_package("express", None).await?;
// Run scripts
npm.run_script("dev").await?;
use vx_core::{Plugin, PluginManager};
use vx_pm_npm::NpmPlugin;
let plugin = NpmPlugin::new();
let mut manager = PluginManager::new();
manager.register_plugin(Box::new(plugin))?;
cd crates/vx-package-managers/vx-pm-npm
cargo build
cargo test
# Test with actual npm installation
cargo test --features integration-tests
// npm commands -> vx npm equivalents
"npm install" -> vx npm install
"npm run dev" -> vx npm run dev
"npx create-react-app" -> vx npx create-react-app
# Security audit
vx npm audit
vx npm audit fix
vx npm audit fix --force
# Audit configuration
vx npm config set audit-level moderate
# Configure npm for better performance
vx npm config set fetch-retries 5
vx npm config set fetch-retry-factor 2
vx npm config set fetch-retry-mintimeout 10000
vx npm config set fetch-retry-maxtimeout 60000
# Clear npm cache
vx npm cache clean --force
# Verify cache
vx npm cache verify
# Check npm configuration
vx npm config list
vx npm config get registry
# Reinstall node_modules
rm -rf node_modules package-lock.json
vx npm install
# Check registry connectivity
vx npm ping
# Use different registry
vx npm config set registry https://registry.npmmirror.com/
# Configure proxy
vx npm config set proxy http://proxy:8080
vx npm config set https-proxy http://proxy:8080
# Fix npm permissions (Unix)
sudo chown -R $(whoami) ~/.npm
sudo chown -R $(whoami) /usr/local/lib/node_modules
# Use different prefix
vx npm config set prefix ~/.npm-global
export PATH=~/.npm-global/bin:$PATH
npm audit.npmrc for project-specific configurationpackage-lock.json for reproducible buildsThis project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please see the contributing guidelines for more information.
vx-core - Core functionalityvx-cli - Command-line interfacevx-tool-node - Node.js toolvx-pm-yarn - Yarn package managervx-pm-pnpm - PNPM package manager