我正在尝试在 Mac OS X 上安装猫鼬:
$ sudo npm install -g mongoose
npm http GET https://registry.npmjs.org/mongoose
npm http 304 https://registry.npmjs.org/mongoose
npm http GET https://registry.npmjs.org/hooks/0.2.1
npm http GET https://registry.npmjs.org/mongodb/1.1.11
npm http GET https://registry.npmjs.org/ms/0.1.0
npm http GET https://registry.npmjs.org/sliced/0.0.3
npm http 304 https://registry.npmjs.org/hooks/0.2.1
npm http 304 https://registry.npmjs.org/mongodb/1.1.11
npm http 304 https://registry.npmjs.org/ms/0.1.0
npm http 304 https://registry.npmjs.org/sliced/0.0.3
npm http GET https://registry.npmjs.org/bson/0.1.5
npm http 304 https://registry.npmjs.org/bson/0.1.5
> bson@0.1.5 install /usr/local/lib/node_modules/mongoose/node_modules/mongodb/node_modules/bson
> node install.js || (exit 0)
================================================================================
= =
= Attempting to build bson c++ extension =
= Windows: no build will be attempted as binaries are prepackaged =
= Unix: on failure the package will still install without the C++ extension =
= =
================================================================================
node-gyp clean
node-gyp configure build
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/bson.node
SOLINK_MODULE(target) Release/bson.node: Finished
child process exited with code 0
mongoose@3.3.1 /usr/local/lib/node_modules/mongoose
├── sliced@0.0.3
├── hooks@0.2.1
├── ms@0.1.0
└── mongodb@1.1.11 (bson@0.1.5)
$ node
> require('mongoose');
Error: Cannot find module 'mongoose'
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:1
at REPLServer.self.eval (repl.js:111:21)
at rli.on.e (repl.js:260:20)
at REPLServer.self.eval (repl.js:118:5)
at Interface.<anonymous> (repl.js:250:12)
at Interface.EventEmitter.emit (events.js:93:17)
不应该require
工作吗?难道我做错了什么?