diff --git a/lib/pip.js b/lib/pip.js index caf48f3e..05fa9392 100644 --- a/lib/pip.js +++ b/lib/pip.js @@ -123,9 +123,16 @@ function installRequirements(targetFolder, serverless, options) { options.pythonBin, '-m', 'pip', - 'install', - ...options.pipCmdExtraArgs + 'install' ]; + + if (Array.isArray(options.pipCmdExtraArgs) && options.pipCmdExtraArgs.length > 0) { + options.pipCmdExtraArgs.forEach(cmd => { + const parts = cmd.split(/\s+/, 2); + pipCmd.push(...parts); + }); + } + const pipCmds = [pipCmd]; const postCmds = []; // Check if we're using the legacy --cache-dir command...