diff options
-rw-r--r-- | lib/install.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/install.js b/lib/install.js index 36754f2c2..5873ca968 100644 --- a/lib/install.js +++ b/lib/install.js @@ -260,14 +260,18 @@ function save (where, installed, tree, pretty, cb) { } catch (ex) { er = ex } - if (er) return cb(null, installed, tree, pretty) + if (er) { + return cb(null, installed, tree, pretty) + + } var deps = npm.config.get("save-optional") ? "optionalDependencies" : npm.config.get("save-dev") ? "devDependencies" : "dependencies" + data[deps] = data[deps] || {} Object.keys(things).forEach(function (t) { - deps[t] = things[t] + data[deps][t] = things[t] }) data = JSON.stringify(data, null, 2) + "\n" fs.writeFile(saveTarget, data, function (er) { |