我最近在一个新的 Linode 盒子上安装了Node.js,我想我处于一个奇怪的情况,我不能require()
用来加载任何第三方模块。
我已经npm
通过 安装并成功安装了模块npm
,但是每当我尝试使用require
其中一个模块(或者只是我自己在同一目录中的一些代码)时,Node.js都会 说它找不到模块。throws
error
关于为什么会发生这种情况的任何想法?
这是一个示例错误消息:
root@li200-141:/home/mike# npm install sequelize npm ERR! sudon't! npm ERR! sudon't! Running npm as root is not recommended! npm ERR! sudon't! Seriously, don't do this! npm ERR! sudon't! npm info it worked if it ends with ok npm info version 0.2.2 npm info fetch http://registry.npmjs.org/sequelize/-/sequelize@0.4.2.tgz npm info install sequelize@0.4.2 npm info activate sequelize@0.4.2 npm info build Success: sequelize@0.4.2 npm ok root@li200-141:/home/mike# node > var n = require('sequelize').Sequelize Error: No such native module sequelize at requireNative (node.js:83:32) at cwdRequire (repl:27:10) at [object Context]:1:9 at Interface.<anonymous> (repl:96:19) at Interface.emit (events:27:15) at Interface._ttyWrite (readline:295:12) at Interface.write (readline:132:30) at Stream.<anonymous> (repl:77:9) at Stream.emit (events:27:15) at IOWatcher.callback (net:489:16)