大家好我正在尝试更新npm和我的mac上安装的节点版本,但我一直收到此错误。有人可以帮助我理解和解决问题,因为我对这个特定问题知之甚少,怎么做。错误如下所示,任何帮助将不胜感激。
npm update
module.js:442
throw err;
^
Error: Cannot find module 'are-we-there-yet'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npmlog/log.js:2:16)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
这是我的log.js文件,以供参考我应该在此修复什么?
'use strict'
var Progress = require('are-we-there-yet')
var Gauge = require('gauge')
var EE = require('events').EventEmitter
var log = exports = module.exports = new EE()
var util = require('util')
var setBlocking = require('set-blocking')
var consoleControl = require('console-control-strings')
setBlocking(true)
var stream = process.stderr
Object.defineProperty(log, 'stream', {
set: function (newStream) {
stream = newStream
if (this.gauge) this.gauge.setWriteTo(stream, stream)
},
get: function () {
return stream
}
})
也是package.json文件,供以下参考
{
"_args": [
[
{
"raw": "npmlog@4.0.0",
"scope": null,
"escapedName": "npmlog",
"name": "npmlog",
"rawSpec": "4.0.0",
"spec": "4.0.0",
"type": "version"
},
"/Users/zkat/Documents/code/npm"
]
],
"_from": "npmlog@4.0.0",
"_id": "npmlog@4.0.0",
"_inCache": true,
"_location": "/npm/npmlog",
"_nodeVersion": "5.10.1",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/npmlog-4.0.0.tgz_1468888150556_0.3835553650278598"
},
"_npmUser": {
"name": "zkat",
"email": "kat@sykosomatic.org"
},
"_npmVersion": "3.10.4",
"_phantomChildren": {
"aproba": "1.0.4",
"has-unicode": "2.0.1",
"readable-stream": "2.1.5",
"strip-ansi": "3.0.1"
},
"_requested": {
"raw": "npmlog@4.0.0",
"scope": null,
"escapedName": "npmlog",
"name": "npmlog",
"rawSpec": "4.0.0",
"spec": "4.0.0",
"type": "version"
},
"_requiredBy": [
"/npm"
],
"_resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.0.0.tgz",
"_shasum": "e094503961c70c1774eb76692080e8d578a9f88f",
"_shrinkwrap": null,
"_spec": "npmlog@4.0.0",
"_where": "/Users/zkat/Documents/code/npm",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"bugs": {
"url": "https://github.com/npm/npmlog/issues"
},
"dependencies": {
"are-we-there-yet": "~1.1.2",
"console-control-strings": "~1.1.0",
"gauge": "~2.6.0",
"set-blocking": "~2.0.0"
},
"description": "logger for npm",
"devDependencies": {
"standard": "~7.1.2",
"tap": "~5.7.0"
},
"directories": {},
"dist": {
"shasum": "e094503961c70c1774eb76692080e8d578a9f88f",
"tarball": "https://registry.npmjs.org/npmlog/-/npmlog-4.0.0.tgz"
},
"files": [
"log.js"
],
"gitHead": "3ca8823fdfa66f54c72adde3fd2c4e0237e6302b",
"homepage": "https://github.com/npm/npmlog#readme",
"license": "ISC",
"main": "log.js",
"maintainers": [
{
"name": "iarna",
"email": "me@re-becca.org"
},
{
"name": "isaacs",
"email": "i@izs.me"
},
{
"name": "othiym23",
"email": "ogd@aoaioxxysz.net"
},
{
"name": "zkat",
"email": "kat@sykosomatic.org"
}
],
"name": "npmlog",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/npmlog.git"
},
"scripts": {
"test": "standard && tap test/*.js"
},
"version": "4.0.0"
}
答案 0 :(得分:2)
我刚刚通过/ usr / local / lib /文件夹删除了所有node和node_module文件夹来解决了我的问题。之后我再次下载了节点,这对我来说很有用,我可以安装和更新npm软件包。
答案 1 :(得分:0)
安装n(简单的Node.js版本管理)
npm install -g n
安装node.js的稳定版本
sudo n stable