diff --git a/lib/modules/manager/npm/extract/yarn.ts b/lib/modules/manager/npm/extract/yarn.ts index a01d6f857c5a2d8f6be72fef2f05f19ceaa4925d..0465a9ce529ddf69d9baa9ae9ecfc38a4c679f19 100644 --- a/lib/modules/manager/npm/extract/yarn.ts +++ b/lib/modules/manager/npm/extract/yarn.ts @@ -51,14 +51,22 @@ export async function getYarnLock(filePath: string): Promise<LockFile> { } export function getZeroInstallPaths(yarnrcYml: string): string[] { - const conf = parseSyml(yarnrcYml); + let conf: any; + try { + conf = parseSyml(yarnrcYml); + } catch (err) /* istanbul ignore next */ { + logger.warn({ err }, 'Error parsing .yarnrc.yml'); + } const paths = [ - conf.cacheFolder || './.yarn/cache', + conf?.cacheFolder || './.yarn/cache', '.pnp.cjs', '.pnp.js', '.pnp.loader.mjs', ]; - if (miscUtils.tryParseOptionalBoolean(conf.pnpEnableInlining) === false) { + if ( + conf && + miscUtils.tryParseOptionalBoolean(conf.pnpEnableInlining) === false + ) { paths.push(conf.pnpDataPath || './.pnp.data.json'); } return paths;