简体   繁体   English

无法运行 node.js 和 npm 示例聊天

[英]unable to run node.js and npm example chat

I am trying to run different chat examples like http://www.giantflyingsaucer.com/blog/?p=2535 I have installed npm and also node properly and its working fine.我正在尝试运行不同的聊天示例,例如http://www.giantflyingsaucer.com/blog/?p=2535我已经安装了 npm 并且节点也正常并且工作正常。 But when ever I trying to run the example code I am getting this error, which I am not able to resolve it.但是,当我尝试运行示例代码时,我遇到了这个错误,我无法解决它。

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
Error: Cannot find module 'express'
    at Function._resolveFilename (module.js:317:11)
    at Function._load (module.js:262:25)
    at require (module.js:346:19)
    at Object.<anonymous> (/home/jeevandongre/Desktop/LearnBoost-socket.io-fbb268f/examples/chat/app.js:12:15)
    at Module._compile (module.js:402:26)
    at Object..js (module.js:408:10)
    at Module.load (module.js:334:31)
    at Function._load (module.js:293:12)
    at Array.<anonymous> (module.js:421:10)
    at EventEmitter._tickCallback (node.js:126:26)

Inside the directory with the example code, run npm install express , that should install it.在包含示例代码的目录中,运行npm install express ,应该会安装它。

Important: This installation is local which means that you'll have to install it in each project you want to use it in seperately.重要提示:此安装是本地安装,这意味着您必须在要单独使用它的每个项目中安装它。

The problem can be fixed by making sure that environment parameter NODE_PATH is set properly.可以通过确保正确设置环境参数NODE_PATH来解决此问题。

export NODE_PATH="C:\Users\IMarek\AppData\Roaming\npm\node_modules"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM