diff --git a/lib/dependency-manager-adapters/npm.js b/lib/dependency-manager-adapters/npm.js index b4b7a691..f4140f25 100644 --- a/lib/dependency-manager-adapters/npm.js +++ b/lib/dependency-manager-adapters/npm.js @@ -133,8 +133,14 @@ module.exports = CoreObject.extend({ if (mgrOptions.indexOf('--ignore-engines') === -1) { mgrOptions = mgrOptions.concat(['--ignore-engines']); } - } else if (mgrOptions.indexOf('--no-shrinkwrap') === -1) { - mgrOptions = mgrOptions.concat(['--no-shrinkwrap']); + } else if (mgrOptions.indexOf('--no-package-lock') === -1) { + let res = await this.run('npm', ['--version'], { cwd: this.cwd, stdio: 'pipe' }); + let version = res.stdout; + if (version.match(/^4./)) { + mgrOptions = mgrOptions.concat(['--no-shrinkwrap']); + } else { + mgrOptions = mgrOptions.concat(['--no-package-lock']); + } } }