从GitHub上拉下一个模块并按照构建说明操作后,我尝试使用以下命令将其拉入现有项目:
> npm install ../faye
这似乎可以解决问题:
> npm list
/home/dave/src/server
└─┬ faye@0.7.1
├── cookiejar@1.3.0
├── hiredis@0.1.13
└── redis@0.7.1
但是 Node.js 找不到这个模块:
> node app.js
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'faye'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object.<anonymous> (/home/dave/src/server/app.js:2:12)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)
我真的很想了解这里到底发生了什么,但我有些不知道接下来该去哪里寻找。有什么建议吗?
node_modules
目录与app.js
文件在你的项目根目录下。为什么你在npm安装路径中使用了“..”? - Alex Wayne