{"id":25859721,"url":"https://github.com/terance-edmonds/nvmalias","last_synced_at":"2025-06-19T00:08:06.761Z","repository":{"id":280097921,"uuid":"940980270","full_name":"terance-edmonds/NvmAlias","owner":"terance-edmonds","description":"A PowerShell utility for Windows to run npm, yarn, or pnpm with specific Node.js versions managed by `nvm`","archived":false,"fork":false,"pushed_at":"2025-03-01T07:34:06.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-19T00:08:01.200Z","etag":null,"topics":["nodejs","npm","nvm","pnpm","powershell","yarn"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terance-edmonds.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-01T07:31:00.000Z","updated_at":"2025-03-01T07:35:07.000Z","dependencies_parsed_at":"2025-03-01T08:36:28.227Z","dependency_job_id":null,"html_url":"https://github.com/terance-edmonds/NvmAlias","commit_stats":null,"previous_names":["terance-edmonds/nvmalias"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/terance-edmonds/NvmAlias","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terance-edmonds%2FNvmAlias","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terance-edmonds%2FNvmAlias/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terance-edmonds%2FNvmAlias/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terance-edmonds%2FNvmAlias/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terance-edmonds","download_url":"https://codeload.github.com/terance-edmonds/NvmAlias/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terance-edmonds%2FNvmAlias/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260654685,"owners_count":23042679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","npm","nvm","pnpm","powershell","yarn"],"created_at":"2025-03-01T21:43:15.141Z","updated_at":"2025-06-19T00:08:01.747Z","avatar_url":"https://github.com/terance-edmonds.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NvmAlias\r\n\r\nA PowerShell utility for Windows to run `npm`, `yarn`, or `pnpm` with specific Node.js versions managed by `nvm`. Think of it as a dynamic alias system (like in Ubuntu) for package managers, letting you easily switch between Node versions without manually typing full paths.\r\n\r\n## Features\r\n\r\n- Run `npm`, `yarn`, or `pnpm` with a specified Node.js version (e.g., `npmv v22 start`).\r\n- Automatically picks the latest matching version if partial (e.g., `v22` uses `v22.9.0` if available).\r\n- Uses exact versions when specified (e.g., `v22.7.0`).\r\n- Displays the Node.js version with `--version` or `-v`.\r\n\r\n## Prerequisites\r\n\r\n- **Node Version Manager (nvm) for Windows**: Install from [nvm-windows](https://github.com/coreybutler/nvm-windows).\r\n- **PowerShell**: Comes with Windows (any modern version works).\r\n\r\n## Installation\r\n\r\n1. **Install nvm for Windows**\r\n   - Download and install `nvm` from [releases](https://github.com/coreybutler/nvm-windows/releases).\r\n   - Verify installation:\r\n     ```powershell\r\n     nvm version\r\n     ```\r\n\r\n2. **Install Node.js Versions**\r\n   - Use `nvm` to install the Node versions you need:\r\n     ```powershell\r\n     nvm install 22.9.0\r\n     nvm install 20.11.0\r\n     ```\r\n   - List installed versions:\r\n     ```powershell\r\n     nvm list\r\n     ```\r\n\r\n3. **(Optional) Install Yarn and pnpm**\r\n   - For `yarnv` and `pnpmv` to work, install these globally for each Node version:\r\n     ```powershell\r\n     nvm use 22.9.0\r\n     npm install -g yarn pnpm\r\n     ```\r\n\r\n4. **Add NvmAlias to PowerShell Profile**\r\n   - Open your PowerShell profile:\r\n     ```powershell\r\n     notepad $PROFILE\r\n     ```\r\n   - If it doesn’t exist, PowerShell will prompt to create it. Confirm with `Y`.\r\n   - Copy and paste the script from [`NvmAlias.ps1`](./NvmAlias.ps1) into your profile.\r\n   - Save and reload your profile:\r\n     ```powershell\r\n     . $PROFILE\r\n     ```\r\n\r\n## Usage\r\n\r\n### Using nvm\r\n- **Install a version**:\r\n  ```powershell\r\n  nvm install 22\r\n  ```\r\n- **Switch versions**:\r\n  ```powershell\r\n  nvm use 22.9.0\r\n  ```\r\n- **List installed versions**:\r\n  ```powershell\r\n  nvm list\r\n  ```\r\n\r\nNvmAlias builds on this by letting you run package managers without needing `nvm use` every time.\r\n\r\n### Using Aliases\r\nRun commands with `npmv`, `yarnv`, or `pnpmv` followed by a version and arguments.\r\n\r\n#### npmv\r\n- Run `npm start` with the latest `v22` version:\r\n  ```powershell\r\n  npmv v22 start\r\n  # Running with Node version: v22.9.0 using npm\r\n  ```\r\n- Use an exact version:\r\n  ```powershell\r\n  npmv v22.7.0 install express\r\n  # Running with Node version: v22.7.0 using npm\r\n  ```\r\n- Check Node.js version:\r\n  ```powershell\r\n  npmv 22 --version\r\n  # Running with Node version: v22.9.0\r\n  # v22.9.0\r\n  ```\r\n\r\n#### yarnv\r\n- Run `yarn install`:\r\n  ```powershell\r\n  yarnv v22 install\r\n  # Running with Node version: v22.9.0 using yarn\r\n  ```\r\n- Check Node.js version:\r\n  ```powershell\r\n  yarnv v20 -v\r\n  # Running with Node version: v20.11.0\r\n  # v20.11.0\r\n  ```\r\n\r\n#### pnpmv\r\n- Run `pnpm add lodash`:\r\n  ```powershell\r\n  pnpmv v22 add lodash\r\n  # Running with Node version: v22.9.0 using pnpm\r\n  ```\r\n- Check Node.js version:\r\n  ```powershell\r\n  pnpmv 22.7.0 --version\r\n  # Running with Node version: v22.7.0\r\n  # v22.7.0\r\n  ```\r\n\r\n- **Note**: Omit the `v` prefix if you prefer (e.g., `npmv 22` works like `npmv v22`).\r\n\r\n## How It Works\r\n\r\n- **Version Resolution**: \r\n  - `v22` finds the latest installed version (e.g., `v22.9.0` if you have `v22.0.2`, `v22.7.0`, `v22.9.0`).\r\n  - Exact matches (e.g., `v22.7.0`) take priority.\r\n- **Package Manager**: Detects `npmv`, `yarnv`, or `pnpmv` and uses the corresponding tool from the Node version folder.\r\n- **Path**: Uses `C:\\Users\\\u003cYourUser\u003e\\AppData\\Roaming\\nvm\\\u003cversion\u003e\\\u003ctool\u003e.cmd`.\r\n\r\n## Troubleshooting\r\n\r\n- **\"No matching Node version found\"**: Ensure the version is installed with `nvm list`.\r\n- **\"yarn/pnpm not found\"**: Install them globally for that Node version (e.g., `npmv v22 install -g yarn`).\r\n- **Profile not loading**: Verify `$PROFILE` path and reload with `. $PROFILE`.\r\n\r\n## License\r\n\r\nMIT License - see [LICENSE](./LICENSE) for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterance-edmonds%2Fnvmalias","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterance-edmonds%2Fnvmalias","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterance-edmonds%2Fnvmalias/lists"}