mirror of
				https://github.com/pnpm/action-setup.git
				synced 2025-11-04 13:29:08 +08:00 
			
		
		
		
	fix: not allow install multiple package manager (#161)
When a project has both npm and pnpm, using pnpm/action-setup will result in an error: `Multiple versions of pnpm specified`. The previous implementation was only meant to avoid the "ERR_PNPM_BAD_PM_VERSION" error, but it did not take into account the situation of multiple different package managers. Signed-off-by: Kevin Cui <bh@bugs.cc>
This commit is contained in:
		@@ -64,6 +64,7 @@ async function readTarget(opts: {
 | 
				
			|||||||
  if (version) {
 | 
					  if (version) {
 | 
				
			||||||
    if (
 | 
					    if (
 | 
				
			||||||
      typeof packageManager === 'string' &&
 | 
					      typeof packageManager === 'string' &&
 | 
				
			||||||
 | 
					      packageManager.startsWith('pnpm@') &&
 | 
				
			||||||
      packageManager.replace('pnpm@', '') !== version
 | 
					      packageManager.replace('pnpm@', '') !== version
 | 
				
			||||||
    ) {
 | 
					    ) {
 | 
				
			||||||
      throw new Error(`Multiple versions of pnpm specified:
 | 
					      throw new Error(`Multiple versions of pnpm specified:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user