解决错误 module.js:339
Posted
技术标签:
【中文标题】解决错误 module.js:339【英文标题】:resolve the error module.js:339 【发布时间】:2016-02-17 05:42:40 【问题描述】:这是我的server.js
代码,我想要一个关于如何解决错误的解决方案:can't find the module 'connect'
var connect = require('connect');
var port = 3000;
connect.createServer connect.static(__dirname )
).listen(port);
console.log('Connect via port '+port);
【问题讨论】:
你安装了模块吗?运行npm -i connect
应该可以工作
Error: Cannot find module 'connect'的可能重复
【参考方案1】:
您需要安装连接包。使用 npm install 命令安装连接包。
npm install connect
【讨论】:
但是当我使用 npm install connect 时我也有问题 npm warn ENOENT: no such file or directory c:\nodeapps\package.json 如何解决它 您是否从 c:\nodeapps 目录执行了命令“npm install”?如果没有,则打开命令提示符将当前目录设置为 c:\nodeapps,然后执行命令 c:\nodeapps。如果这仍然不起作用,则可能您已全局安装连接,并且您需要使用“npm link connect”链接它 你也可以确认 server.js 文件和你的 package.son 位于同一目录中。 sir mi直接下载window 7的node模块? 如果是那么如何下载以上是关于解决错误 module.js:339的主要内容,如果未能解决你的问题,请参考以下文章
Error: Cannot find module 'gulp-sass'