diff options
author | Julian Duque <julianduquej@gmail.com> | 2016-05-18 16:44:26 +0300 |
---|---|---|
committer | Kat Marchán <kzm@sykosomatic.org> | 2016-07-01 01:50:08 +0300 |
commit | 2a37c97121483db2b6f817fe85c2a5a77b76080e (patch) | |
tree | aae00a5bed0c772f464dceef28a849b62fec2339 /lib | |
parent | ea018b9e3856d1798d199ae3ebce4ed07eea511b (diff) |
cache: ignore enoent on chownr while adding packages to cache
Fixes: https://github.com/npm/npm/issues/12669
PR-URL: https://github.com/npm/npm/pull/13023
Credit: @julianduque
Reviewed-By: @othiym23
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cache/add-local.js | 5 | ||||
-rw-r--r-- | lib/utils/correct-mkdir.js | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/cache/add-local.js b/lib/cache/add-local.js index c8c6fb01c..0794b9214 100644 --- a/lib/cache/add-local.js +++ b/lib/cache/add-local.js @@ -107,7 +107,10 @@ function addLocalDirectory (p, pkgData, shasum, cb) { if (!cs || isNaN(cs.uid) || isNaN(cs.gid)) return wrapped() - chownr(made || tgz, cs.uid, cs.gid, wrapped) + chownr(made || tgz, cs.uid, cs.gid, function (er) { + if (er && er.code === 'ENOENT') return wrapped() + wrapped(er) + }) }) } }) diff --git a/lib/utils/correct-mkdir.js b/lib/utils/correct-mkdir.js index 955af63a7..68c4a4ad7 100644 --- a/lib/utils/correct-mkdir.js +++ b/lib/utils/correct-mkdir.js @@ -117,6 +117,7 @@ function makeDirectory (path, cb) { function setPermissions (path, st, cb) { chownr(path, st.uid, st.gid, function (er) { + if (er && er.code === 'ENOENT') return cb(null, st) return cb(er, st) }) } |