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:
-rw-r--r--lib/install.js2
-rw-r--r--lib/utils/error-handler.js15
-rw-r--r--npm.js2
3 files changed, 15 insertions, 4 deletions
diff --git a/lib/install.js b/lib/install.js
index 31fcf32af..01eb1a983 100644
--- a/lib/install.js
+++ b/lib/install.js
@@ -491,7 +491,7 @@ function checkEngine (target, cb) {
if (eng.node && !semver.satisfies(nodev, eng.node)
|| eng.npm && !semver.satisfies(npmv, eng.npm)) {
var er = new Error("Unsupported")
- er.errno = npm.EENGINE
+ er.errno = npm.ENOTSUP
er.required = eng
er.pkgid = target._id
return cb(er)
diff --git a/lib/utils/error-handler.js b/lib/utils/error-handler.js
index 4dc183da7..d8edc76d3 100644
--- a/lib/utils/error-handler.js
+++ b/lib/utils/error-handler.js
@@ -56,6 +56,7 @@ function errorHandler (er) {
}
switch (er.errno) {
+ case "ECONNREFUSED":
case constants.ECONNREFUSED:
log.error(er)
log.error(["If you are using Cygwin, please set up your /etc/resolv.conf"
@@ -67,6 +68,8 @@ function errorHandler (er) {
].join("\n"))
break
+ case "EACCES":
+ case "EPERM":
case constants.EACCES:
case constants.EPERM:
log.error(er)
@@ -83,6 +86,7 @@ function errorHandler (er) {
break
case npm.ELIFECYCLE:
+ er.code = "ELIFECYCLE"
log.error(er.message)
log.error(["","Failed at the "+er.pkgid+" "+er.stage+" script."
,"This is most likely a problem with the "+er.pkgname+" package,"
@@ -96,6 +100,7 @@ function errorHandler (er) {
break
case npm.EJSONPARSE:
+ er.code = "EJSONPARSE"
log.error(er.message)
log.error("File: "+er.file)
log.error(["Failed to parse package.json data."
@@ -106,6 +111,7 @@ function errorHandler (er) {
break
case npm.E404:
+ er.code = "E404"
if (er.pkgid && er.pkgid !== "-") {
var msg = ["'"+er.pkgid+"' is not in the npm registry."
,"You could maybe bug the author to publish it"]
@@ -122,6 +128,7 @@ function errorHandler (er) {
break
case npm.EPUBLISHCONFLICT:
+ er.code = "EPUBLISHCONFLICT"
log.error(["Cannot publish over existing version."
,"Bump the 'version' field, set the --force flag, or"
," npm unpublish '"+er.pkgid+"'"
@@ -130,6 +137,7 @@ function errorHandler (er) {
break
case npm.EISGIT:
+ er.code = "EISGIT"
log.error([er.message
," "+er.path
,"Refusing to remove it. Update manually,"
@@ -138,6 +146,7 @@ function errorHandler (er) {
break
case npm.ECYCLE:
+ er.code = "ECYCLE"
log.error([er.message
,"While installing: "+er.pkgid
,"Found a pathological dependency case that npm cannot solve."
@@ -145,7 +154,8 @@ function errorHandler (er) {
].join("\n"))
break
- case npm.EENGINE:
+ case npm.ENOTSUP:
+ er.code = "ENOTSUP"
log.error([er.message
,"Not compatible with your version of node/npm: "+er.pkgid
,"Required: "+JSON.stringify(er.required)
@@ -155,6 +165,7 @@ function errorHandler (er) {
].join("\n"))
break
+ case "EEXIST":
case constants.EEXIST:
log.error([er.message
,"File exists: "+er.path
@@ -184,7 +195,7 @@ function errorHandler (er) {
if (er.type) log.error(er.type, "type")
if (er.arguments) log.error(er.arguments, "arguments")
if (er.code) log.error(er.code, "code")
- if (er.errno) log.error(er.errno, "errno")
+ if (er.errno && typeof er.errno !== "object") log.error(er.errno, "errno")
exit(typeof er.errno === "number" ? er.errno : 1)
}
diff --git a/npm.js b/npm.js
index 59130803a..3578ac648 100644
--- a/npm.js
+++ b/npm.js
@@ -28,7 +28,7 @@ npm.EPUBLISHCONFLICT = {}
npm.EJSONPARSE = {}
npm.EISGIT = {}
npm.ECYCLE = {}
-npm.EENGINE = {}
+npm.ENOTSUP = {}
// HACK for windows
if (process.platform === "win32") {