How to install node.js and create project in Eclipse -


the steps i've tried: 1.(ok) install node official website: https://nodejs.org/en/download/ result: i'm able open cmd(in location, type node use commands "console.log" , prints messages)

2.(failure) install express using npm install -g express cmd gives me error(picture attachedenter image description here

3.(ok) i've succeed installing express using following command npm install express (without -g) 4.(ok) writing simple hello world program works. javascript file:

var http = require('http');  // configure our http server respond hello world requests. var server = http.createserver(function (request, response) {   response.writehead(200, {"content-type": "text/plain"});   response.end("hello world\n"); });  // listen on port 8000, ip defaults 127.0.0.1 server.listen(8000);  // put friendly message on terminal console.log("server running @ http://127.0.0.1:8000/"); 

5.(failure) however, wanna run bigger project, besides 1 js file, have index.html file. if move both files node installation directory, works. wanna able keep projects somewhere else. if try run node c:\users\marius\downloads\chat-example-master\indes.js error: cannot find module express. seems when installed express without "-g" got working in node directory.(let me know if have doubt). 6.(failure) when creating node.js project eclipse, choose empty project, no template, add single , simple js file(the 1 hello world), right click on project name -> run -> run configuration -> node application -> new -> add .js file -> run. following error: exception occurred executing command line.(steps http://techprd.com/how-to-setup-node-js-project-in-eclipse/)

cannot run program "node" (in directory "c:\users\marius\workspace\firstnodeproject"): createprocess error=2, system cannot find file specified 

to recap: want able run node projects located anywhere "node" in cmd , create node.js , express project , run them eclipse. please let me know if need more information.

just let others know if come across issue. can run express apps anywhere in root folder of every app have npm install express. in eclipse need is: window->preferences->nodeclipse->uncheck "find .node on path" , insert node.js path input node.exe location (in case: c:\program files\nodejs\node.exe)


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -