首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误:找不到模块'mkdirp‘

错误:找不到模块'mkdirp‘
EN

Stack Overflow用户
提问于 2014-03-25 11:39:43
回答 3查看 29.7K关注 0票数 11

当我尝试运行nodeJS文件时,在我的Ubuntu机器上得到以下错误

代码语言:javascript
复制
node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: Cannot find module 'mkdirp'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object.<anonymous> (/home//dev/ation/siya/common.js:7:19)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Module.require (module.js:354:17)

所以我尝试了npm install mkdirp

代码语言:javascript
复制
npm http GET https://registry.npmjs.org/mkdirp

npm ERR! Error: failed to fetch from registry: mkdirp
npm ERR!     at /home/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/home/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/home/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/home//local/lib/node_modules/npm/node_modules/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/home/local/lib/node_modules/npm/node_modules/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/home/local/lib/node_modules/npm/node_modules/request/main.js:412:12)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.onIncoming (http.js:1261:11)
npm ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>
npm ERR! 
npm ERR! System Linux 3.2.0-23-generic
npm ERR! command "node" "/home/local/bin/npm" "install" "mkdirp"
npm ERR! cwd /home/dev/tst_tion/servrs/sc
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: mkdirp
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/ushusadmin/dev/test_automation/servers/scriptAgentServer/npm-debug.log
npm not ok

我该如何解决这个问题?

npm debug.log文件

代码语言:javascript
复制
info it worked if it ends with ok
verbose cli [ 'node', '/home/ushusadmin/local/bin/npm', 'install', 'mkdirp' ]
info using npm@1.1.4
info using node@v0.6.12
verbose config file /home/ushusadmin/.npmrc
verbose config file /home/ushusadmin/local/etc/npmrc
verbose config file /home/ushusadmin/local/lib/node_modules/npm/npmrc
verbose caching /home/ushusadmin/dev/test_automation/servers/scriptAgentServer/node_modules/node-schedule/package.json
verbose caching /home/ushusadmin/dev/test_automation/servers/scriptAgentServer/node_modules/nodemailer/package.json
verbose caching /home/ushusadmin/dev/test_automation/servers/scriptAgentServer/node_modules/mustache/package.json
verbose caching /home/ushusadmin/dev/test_automation/servers/scriptAgentServer/node_modules/qs/package.json
verbose caching /home/ushusadmin/dev/test_automation/servers/scriptAgentServer/node_modules/mongodb/package.json
verbose cache add [ 'mkdirp', null ]
silly cache add: name, spec, args [ undefined, 'mkdirp', [ 'mkdirp', null ] ]
verbose parsed url { pathname: 'mkdirp', path: 'mkdirp', href: 'mkdirp' }
verbose addNamed [ 'mkdirp', '' ]
verbose addNamed [ null, '' ]
silly name, range, hasData [ 'mkdirp', '', false ]
verbose raw, before any munging mkdirp
verbose url resolving [ 'https://registry.npmjs.org/', './mkdirp' ]
verbose url resolved https://registry.npmjs.org/mkdirp
http GET https://registry.npmjs.org/mkdirp
ERR! Error: failed to fetch from registry: mkdirp
ERR!     at /home/ushusadmin/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:139:12
ERR!     at cb (/home/ushusadmin/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:31:9)
ERR!     at Request._callback (/home/ushusadmin/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:136:18)
ERR!     at Request.callback (/home/ushusadmin/local/lib/node_modules/npm/node_modules/request/main.js:119:22)
ERR!     at Request.<anonymous> (/home/ushusadmin/local/lib/node_modules/npm/node_modules/request/main.js:212:58)
ERR!     at Request.emit (events.js:88:20)
ERR!     at ClientRequest.<anonymous> (/home/ushusadmin/local/lib/node_modules/npm/node_modules/request/main.js:412:12)
ERR!     at ClientRequest.emit (events.js:67:17)
ERR!     at HTTPParser.onIncoming (http.js:1261:11)
ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
ERR! You may report this log at:
ERR!     <http://github.com/isaacs/npm/issues>
ERR! or email it to:
ERR!     <npm-@googlegroups.com>
ERR! 
ERR! System Linux 3.2.0-23-generic
ERR! command "node" "/home/ushusadmin/local/bin/npm" "install" "mkdirp"
ERR! cwd /home/ushusadmin/dev/test_automation/servers/scriptAgentServer
ERR! node -v v0.6.12
ERR! npm -v 1.1.4
ERR! message failed to fetch from registry: mkdirp
verbose exit [ 1, true ]

实际发生的情况是,当尝试使用命令安装锡库利时,删除了以下items..how,我可以恢复此项目吗

$ sudo aptitude安装sikuli-ide

代码语言:javascript
复制
Removing libc-ares-dev ...
Removing libc-ares2 ...
Removing libev-dev ...
Removing libev4 ...
Removing libv8-dev ...
Removing libv8-3.7.12.22 ...
Removing node-abbrev ...
Removing node-tar ...
Removing node-block-stream ...
Removing node-fstream ...
Removing node-graceful-fs ...
Removing node-inherits ...
Removing node-ini ...
Removing node-minimatch ...
Removing node-lru-cache ...
Removing node-mkdirp ...
Removing node-node-uuid ...
Removing node-nopt ...
Removing node-request ...
Removing node-rimraf ...
Removing node-semver ...
Removing node-which ...
EN

回答 3

Stack Overflow用户

发布于 2014-04-15 03:40:25

使用手动过程安装mkdirp:

请转到https://registry.npmjs.org/mkdirp/latest

  • Copy“
  • ”的URL值: key
  • Download the tarball
  • 在您的node_modules path

下将其展开

对已删除的包使用通用模式:

请转到https://registry.npmjs.org/{module}/latest

  • Copy“tarball”的URL值: key

  • Download
  • it under your node_modules path

或者,使用npm install name@version语法:

代码语言:javascript
复制
 npm install mkdirp@latest

或npm install git语法:

代码语言:javascript
复制
 npm install git://github.com/substack/node-mkdirp.git

参考

票数 13
EN

Stack Overflow用户

发布于 2016-06-11 08:35:54

在我的例子中,我试图从我的用户没有足够权限的目录中运行npm install。看一下这些,看看这是否可能是问题所在。

票数 2
EN

Stack Overflow用户

发布于 2017-07-03 22:55:30

尝试使用纱线包装管理器,通过使用yarn命令。它为我解决了这类问题

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22625024

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档