npm API - 不能要求模块npm

时间:2013-03-29 23:59:08

标签: node.js npm require

在npm文档上,它说我可以要求它并使用它的api然而当我这样做时:

$ node
var npm = require("npm");
Error: Cannot find module 'npm'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at repl:1:11
    at REPLServer.self.eval (repl.js:109:21)
    at rli.on.self.bufferedCmd (repl.js:258:20)
    at REPLServer.self.eval (repl.js:116:5)
    at Interface.<anonymous> (repl.js:248:12)
    at Interface.EventEmitter.emit (events.js:96:17)
>

1 个答案:

答案 0 :(得分:1)

它可以做$ sudo npm install --save npm

抱歉