azat-co / expressworks

Learn Express.js from the author of one of the best books on Express.js—Pro Express.js— with this workshop that will teach you basics of Express.js.
MIT License
709 stars 220 forks source link

expressworks run hello-world.js #52

Closed js08 closed 9 years ago

js08 commented 9 years ago

Hi,

I copied the answer from the solution then also its not working.. can you guys tell me why iuts not working

C:\Users\Desktop\node-school\express> expressworks run hello-world.js Running "HELLO WORLD!"...

module.js:340 throw err; ^ Error: Cannot find module 'express' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (C:\Users\Desktop\node-school\express\hello-world.js:1:77) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10)

events.js:72 throw er; // Unhandled 'error' event ^ Error: connect ECONNREFUSED at errnoException (net.js:904:11) at Object.afterConnect as oncomplete

rodrigo-medeiros commented 9 years ago

Do you have express module installed?

js08 commented 9 years ago

Yes do you want me to share the screenshot On Jan 30, 2015 4:49 AM, "Rodrigo Medeiros" notifications@github.com wrote:

Do you have express module installed?

— Reply to this email directly or view it on GitHub.

rodrigo-medeiros commented 9 years ago

Ok then. So, if you run node in the directory where you're running your test, you can do a var express = require('express'), I assume. Do you have any other instance of node.js running on your machine?

js08 commented 9 years ago

can you share a screenshot..how to do it...i am confused with what your saying....

rodrigo-medeiros commented 9 years ago

i am confused with what your saying....

No problem. You said that you have express installed. But is it installed globally or only in one directory? Like, based on what you explained, you installed expressworks in C:\Users\Desktop\node-school\express. If you have express installed globally or at least in this folder, when you run npm ls express inside this folder, it'll show which version is installed. If it's not installed, it'll show (empty). In this case, just run npm install express from the same directory. If the existence of express is not the problem, you need to check if there isn't another instance of node running with the command (you're on a Windows box) taskkill /F /im node.exe. If none of the two solutions work, post here.

js08 commented 9 years ago

@rodrigo-medeiros yeah it shows empty do i need to run this command in terminal taskkill /F /im node.exe

rodrigo-medeiros commented 9 years ago

If it's not installed, it'll show (empty). In this case, just run npm install express from the same directory.

express is not a dependency of expressworks, but in order to run a node.js file that require('express'), you have to install it manually with npm install express. Just do it and you'll be good to go.

js08 commented 9 years ago

@rodrigo-medeiros yeah its working...can u tell me how this command will work taskkill /F /im node.exe just curious to know

rodrigo-medeiros commented 9 years ago

Sure. taskkill is the Windows equivalent to Unix kill. In other words: it'll kill processes (or tasks, in Windows). The /F is to force the process to exit, because if the OS sees that this process is doing something, it might want to wait it finish the job. And the /im is the option that you use to pass the name of the process you want to kill (in your case, node.exe).

js08 commented 9 years ago

@rodrigo-medeiros i use git shell can i execute this commands in git shell

rodrigo-medeiros commented 9 years ago

Yes, you can: they're Windows commands.

js08 commented 9 years ago

@rodrigo-medeiros can you give those commands I wanted to try it out

rodrigo-medeiros commented 9 years ago

Sorry @rk08, I don't undersand what you mean. Which commands?

js08 commented 9 years ago

I WANTED GIT SHELL COMMANDS FOR THIS taskkill

rodrigo-medeiros commented 9 years ago

Well @rk08, on Windows you can use taskkill on cmd or git bash. But I'm not sure if the Unix kill command will work on git bash. You can it try yourself: follow this link that shows briefly how to use it.