Npm doesn't work

I have installed node version v0.10.35, but when I try to work with npm it results in an error:

npm is installed when I installed node, checking the node version does not throw an error, but checking the npm version with npm --version throws an error

Error: npm doesn't work with node v0.10.35
Required: node@0.4 || 0.5 || 0.6
at /usr/lib/node_modules/npm/bin/npm-cli.js:57:23
at Object.<anonymous> (/usr/lib/node_modules/npm/bin/npm-cli.js:77:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:929:3

      

npm --version throws an error

   npm --version
[TypeError: Object function log(msg, pref, level, cb) {
  if (typeof level === "function") cb = level, level = null
  var show = log.level
  if (show === LEVEL.silent || show === LEVEL.paused) return cb && cb()
  if (level == null) level = LEVEL.info
  if (isNaN(level)) level = LEVEL[level]
  else level = +level

  // logging just undefined is almost never the right thing.
  // a lot of these are kicking around throughout the codebase
  // with relatively unhelpful prefixes.
  if (msg === undefined && level > LEVEL.silly) {
    msg = new Error("undefined log message")
  }
  if (typeof msg === "object" && (msg instanceof Error)) level = LEVEL.error
  if (!ini.resolved && waitForConfig || level === LEVEL.paused) {
    return logBuffer.push([msg, pref, level, cb])
  }
  if (logBuffer.length && !logBuffer.discharging) {
    logBuffer.push([msg, pref, level, cb])
    logBuffer.discharging = true
    logBuffer.forEach(function (l) { log.apply(null, l) })
    logBuffer.length = 0
    delete logBuffer.discharging
    return
  }
  log.level = show
  npm.emit("log", { level : level, msg : msg, pref : pref, cb : cb })
  npm.emit("log."+normalNames[level], { msg : msg, pref : pref, cb : cb })
} has no method 'error'] 

      

What could be the problem?

+3


source to share





All Articles