Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
Creating lib directory before installing
Browse files Browse the repository at this point in the history
  • Loading branch information
thefourtheye authored and iarna committed Jun 21, 2015
1 parent df46773 commit 6401643
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,26 +401,28 @@ Installer.prototype.readLocalPackageData = function (cb) {
validate('F', arguments)
log.silly('install', 'readLocalPackageData')
var self = this
readPackageTree(this.where, iferr(cb, function (currentTree) {
self.currentTree = currentTree
if (!self.noPackageJsonOk && !currentTree.package) {
log.error('install', "Couldn't read dependencies")
var er = new Error("ENOENT, open '" + path.join(self.where, 'package.json') + "'")
er.code = 'ENOPACKAGEJSON'
er.errno = 34
return cb(er)
}
if (!currentTree.package) currentTree.package = {}
if (currentTree.package._shrinkwrap) return cb()
fs.readFile(path.join(self.where, 'npm-shrinkwrap.json'), {encoding: 'utf8'}, function (er, data) {
if (er) return cb()
try {
currentTree.package._shrinkwrap = JSON.parse(data)
} catch (ex) {
return cb(ex)
}
return cb()
})
mkdirp(this.where, iferr(cb, function () {
readPackageTree(self.where, iferr(cb, function (currentTree) {
self.currentTree = currentTree
if (!self.noPackageJsonOk && !currentTree.package) {
log.error('install', "Couldn't read dependencies")
var er = new Error("ENOENT, open '" + path.join(self.where, 'package.json') + "'")
er.code = 'ENOPACKAGEJSON'
er.errno = 34
return cb(er)
}
if (!currentTree.package) currentTree.package = {}
if (currentTree.package._shrinkwrap) return cb()
fs.readFile(path.join(self.where, 'npm-shrinkwrap.json'), {encoding: 'utf8'}, function (er, data) {
if (er) return cb()
try {
currentTree.package._shrinkwrap = JSON.parse(data)
} catch (ex) {
return cb(ex)
}
return cb()
})
}))
}))

}
Expand Down

0 comments on commit 6401643

Please sign in to comment.