Skip to content

Commit

Permalink
Create the prefix install directory to support npm >= 7 #123
Browse files Browse the repository at this point in the history
  • Loading branch information
deepy committed Nov 13, 2020
1 parent 90f0ebe commit 486ee01
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ class NpmSetupTask
if ( !npmVersion.isEmpty() )
{
logger.debug( "Setting npmVersion to ${npmVersion}" )
setArgs(['install', '--global', '--no-save'] + proxySettings() + ['--prefix', getVariant().npmDir.absolutePath, "npm@${npmVersion}"])
def directory = getVariant().npmDir
// npm < 7 creates the directory if it's missing, >= 7 fails if it's missing
directory.mkdirs()
setArgs(['install', '--global', '--no-save'] + proxySettings() + ['--prefix', directory.absolutePath, "npm@${npmVersion}"])
enabled = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ class YarnSetupTask
pkg += "@${yarnVersion}"
}

this.setArgs(['install', '--global', '--no-save'] + proxySettings() + ['--prefix', this.getVariant().yarnDir.absolutePath, pkg])
def directory = this.getVariant().yarnDir
// npm < 7 creates the directory if it's missing, >= 7 fails if it's missing
// create the directory since we use npm to install yarn.
directory.mkdirs()
this.setArgs(['install', '--global', '--no-save'] + proxySettings() + ['--prefix', directory.absolutePath, pkg])
enabled = true
}
}

0 comments on commit 486ee01

Please sign in to comment.