Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/install.js')
-rw-r--r--lib/install.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/install.js b/lib/install.js
index 80ffb0aa8..3a1dc5b98 100644
--- a/lib/install.js
+++ b/lib/install.js
@@ -139,6 +139,7 @@ var doParallelActions = require('./install/actions.js').doParallel
var doOneAction = require('./install/actions.js').doOne
var removeObsoleteDep = require('./install/deps.js').removeObsoleteDep
var removeExtraneous = require('./install/deps.js').removeExtraneous
+var computeVersionSpec = require('./install/deps.js').computeVersionSpec
var packageId = require('./utils/package-id.js')
var moduleName = require('./utils/module-name.js')
var errorMessage = require('./utils/error-message.js')
@@ -249,8 +250,7 @@ Installer.prototype.run = function (_cb) {
if (!this.dryrun) {
installSteps.push(
[this.newTracker(log, 'runTopLevelLifecycles', 2)],
- [this, this.runPreinstallTopLevelLifecycles]
- )
+ [this, this.runPreinstallTopLevelLifecycles])
}
installSteps.push(
[this.newTracker(log, 'loadCurrentTree', 4)],
@@ -358,6 +358,14 @@ var flatNameFromTree = require('./install/flatten-tree.js').flatNameFromTree
Installer.prototype.normalizeCurrentTree = function (cb) {
this.currentTree.isTop = true
normalizeTree(this.currentTree)
+ // If the user didn't have a package.json then fill in deps with what was on disk
+ if (this.currentTree.error) {
+ for (let child of this.currentTree.children) {
+ if (!child.fakeChild && isExtraneous(child)) {
+ this.currentTree.package.dependencies[child.package.name] = computeVersionSpec(this.currentTree, child)
+ }
+ }
+ }
return cb()
function normalizeTree (tree) {