Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何解决module.js:442错误_Node.js_Npm - Fatal编程技术网

Node.js 如何解决module.js:442错误

Node.js 如何解决module.js:442错误,node.js,npm,Node.js,Npm,大家好,我正在尝试更新npm和mac上安装的node版本,但我一直收到这个错误。有人能帮我理解并解决这个问题吗?因为我对这个问题以及如何解决这个问题不太了解。错误如下所示,如有任何帮助,将不胜感激 npm update module.js:442 throw err; ^ Error: Cannot find module 'are-we-there-yet' at Function.Module._resolveFilename (module.js:440:15)

大家好,我正在尝试更新npm和mac上安装的node版本,但我一直收到这个错误。有人能帮我理解并解决这个问题吗?因为我对这个问题以及如何解决这个问题不太了解。错误如下所示,如有任何帮助,将不胜感激

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)
另请参阅下面的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"
}

我只是通过转到/usr/local/lib/folder删除所有节点和节点\模块文件夹来解决问题。之后,我再次下载了node,这对我来说是可行的,我可以安装和更新npm包

  • 安装(simple Node.js版本管理)

    npm安装-g n

  • 安装node.js的稳定版本

    sudo n stable


您正在尝试更新节点版本或软件包版本?npm更新更新程序包而不是节点version@HugoFarji是的,基本上是npm软件包,然后是节点版本,但是这个错误不允许我做任何事情,因为这个错误,我甚至无法安装新软件包。你能给我们看一下你的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"
}