npm & Nx Command Reference
Quick reference for package management and monorepo commands in EBRAINS UI Ecosystem.
Quick Links
- Nx Commands Reference - Monorepo development and build commands
- npm Commands Reference - Package management and dependency installation
Overview
The EBRAINS UI Ecosystem uses:
- Nx - Smart monorepo tool for building and testing applications
- npm - Package manager for installing and managing dependencies
Together, they provide a powerful development environment for building EBRAINS applications.
Getting Started
If you’re new to the EBRAINS UI Ecosystem:
- Build Your First App Tutorial - Complete walkthrough
- Install dependencies:
npm install - Generate app:
npx nx generate @nx/react:application my-app - Serve app:
nx serve my-app
Quick Examples
Create and Run New App
Install and Use Package
Run Quality Checks
Common Commands Comparison
| Task | Nx Command | npm Command |
|---|---|---|
| Install dependencies | - | npm install |
| Generate app | npx nx generate @nx/react:application my-app | - |
| Serve app | nx serve my-app | npm run serve |
| Build app | nx build my-app | npm run build |
| Test app | nx test my-app | npm test |
| Lint app | nx lint my-app | npm run lint |
| Add package | - | npm install package-name |
| Update packages | - | npm update |
| Run script | - | npm run script-name |
Nx Quick Reference
Generate
Develop
Monorepo
npm Quick Reference
Install
Manage
Scripts
Typical Workflow
Day 1: Setup
Daily Development
Adding New Dependency
Running Quality Checks
Common Ports
| Application | Port |
|---|---|
| React apps | 4200, 4300, 4400 |
| Handbook (Hugo) | 1313 |
| Custom port | Use --port=XXXX |
Troubleshooting
Command Not Found: nx
Port Already in Use
Module Not Found
Build Fails
Best Practices
Do
- Use
npx nxfor Nx commands - Commit
package-lock.json - Run
npm auditregularly - Use Nx generators for new projects
- Keep dependencies updated
- Use
nx affectedin CI/CD - Clear cache when debugging (
nx reset)
Don’t
- Don’t commit
node_modules/ - Don’t manually edit
package-lock.json - Don’t skip migrations after Nx updates
- Don’t ignore security warnings
- Don’t use
sudo npm install - Don’t create projects manually (use generators)
External Resources
- Nx Documentation - Official Nx docs
- npm Documentation - Official npm docs
- React Documentation - React framework
- Vite Documentation - Build tool