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
path: root/lib
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2015-08-01 02:16:41 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-08-28 02:54:28 +0300
commit79f5f271999fc249780c05f36a2a48624a0a23ed (patch)
tree51afc9c0f7c496abc803a6bd404e11130eb57198 /lib
parent4c1bcea9831f3ed57347b9a801e94a8b404e75f9 (diff)
install: warn on preferGlobal when there's no deps
PR-URL: https://github.com/npm/npm/pull/9409
Diffstat (limited to 'lib')
-rw-r--r--lib/build.js4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/build.js b/lib/build.js
index cb8720f7e..7793a07b6 100644
--- a/lib/build.js
+++ b/lib/build.js
@@ -134,10 +134,8 @@ function shouldWarn (pkg, folder, global, cb) {
// current searched package is the linked package on first call
if (linkedPkg !== currentPkg) {
- if (!topPkg.dependencies) return cb()
-
// don't generate a warning if it's listed in dependencies
- if (Object.keys(topPkg.dependencies).indexOf(currentPkg) === -1) {
+ if (Object.keys(topPkg.dependencies || {}).indexOf(currentPkg) === -1) {
if (top && pkg.preferGlobal && !global) {
log.warn('prefer global', getPackageId(pkg) + ' should be installed with -g')