From 5a85e67b2ee4c296dab92bd063197e5564b699dc Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Wed, 17 Oct 2018 12:33:49 +0200 Subject: [PATCH] =?UTF-8?q?fix(npm):=20don=E2=80=99t=20error=20if=20no=20d?= =?UTF-8?q?ependencies=20in=20lock=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/manager/npm/post-update/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/manager/npm/post-update/index.js b/lib/manager/npm/post-update/index.js index 21662afe8c..0afee7daf1 100644 --- a/lib/manager/npm/post-update/index.js +++ b/lib/manager/npm/post-update/index.js @@ -206,14 +206,16 @@ async function writeExistingFiles(config, packageFiles) { logger.info(`Removing ${widens} from ${npmLock} to force an update`); try { const npmLockParsed = JSON.parse(existingNpmLock); - widens.forEach(depName => { - delete npmLockParsed.dependencies[depName]; - }); + if (npmLockParsed.dependencies) { + widens.forEach(depName => { + delete npmLockParsed.dependencies[depName]; + }); + } existingNpmLock = JSON.stringify(npmLockParsed, null, 2); } catch (err) { logger.warn( { npmLock }, - 'Error massing package-lock.json for widen' + 'Error massaging package-lock.json for widen' ); } } -- GitLab