meetpatty / HENkaku-webserver

49 stars 15 forks source link

Server works but does not detect system-wide express/request installs #5

Open parkerlreed opened 8 years ago

parkerlreed commented 8 years ago

Arch x86_64 nodejs 6.3.0-1 npm 3.10.3-1

[parker@e73 Nodejs]$ node HENkaku-webservice.js 
module.js:442
    throw err;
    ^

Error: Cannot find module 'express'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/parker/build/HENkaku-webserver/Nodejs/HENkaku-webservice.js:1:77)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
[parker@e73 Nodejs]$ sudo npm install -g express
[sudo] password for parker: 
/usr/lib
└─┬ express@4.14.0 
  ├─┬ accepts@1.3.3 
  │ ├─┬ mime-types@2.1.11 
  │ │ └── mime-db@1.23.0 
  │ └── negotiator@0.6.1 
  ├── array-flatten@1.1.1 
  ├── content-disposition@0.5.1 
  ├── content-type@1.0.2 
  ├── cookie@0.3.1 
  ├── cookie-signature@1.0.6 
  ├─┬ debug@2.2.0 
  │ └── ms@0.7.1 
  ├── depd@1.1.0 
  ├── encodeurl@1.0.1 
  ├── escape-html@1.0.3 
  ├── etag@1.7.0 
  ├─┬ finalhandler@0.5.0 
  │ ├── statuses@1.3.0 
  │ └── unpipe@1.0.0 
  ├── fresh@0.3.0 
  ├── merge-descriptors@1.0.1 
  ├── methods@1.1.2 
  ├─┬ on-finished@2.3.0 
  │ └── ee-first@1.1.1 
  ├── parseurl@1.3.1 
  ├── path-to-regexp@0.1.7 
  ├─┬ proxy-addr@1.1.2 
  │ ├── forwarded@0.1.0 
  │ └── ipaddr.js@1.1.1 
  ├── qs@6.2.0 
  ├── range-parser@1.2.0 
  ├─┬ send@0.14.1 
  │ ├── destroy@1.0.4 
  │ ├─┬ http-errors@1.5.0 
  │ │ ├── inherits@2.0.1 
  │ │ └── setprototypeof@1.0.1 
  │ └── mime@1.3.4 
  ├── serve-static@1.11.1 
  ├─┬ type-is@1.6.13 
  │ └── media-typer@0.3.0 
  ├── utils-merge@1.0.0 
  └── vary@1.1.0 

[parker@e73 Nodejs]$ node HENkaku-webservice.js 
module.js:442
    throw err;
    ^

Error: Cannot find module 'express'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/parker/build/HENkaku-webserver/Nodejs/HENkaku-webservice.js:1:77)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
[parker@e73 Nodejs]$ npm install express
/home/parker/build/HENkaku-webserver/Nodejs
└─┬ express@4.14.0 
  ├─┬ accepts@1.3.3 
  │ ├─┬ mime-types@2.1.11 
  │ │ └── mime-db@1.23.0 
  │ └── negotiator@0.6.1 
  ├── array-flatten@1.1.1 
  ├── content-disposition@0.5.1 
  ├── content-type@1.0.2 
  ├── cookie@0.3.1 
  ├── cookie-signature@1.0.6 
  ├─┬ debug@2.2.0 
  │ └── ms@0.7.1 
  ├── depd@1.1.0 
  ├── encodeurl@1.0.1 
  ├── escape-html@1.0.3 
  ├── etag@1.7.0 
  ├─┬ finalhandler@0.5.0 
  │ ├── statuses@1.3.0 
  │ └── unpipe@1.0.0 
  ├── fresh@0.3.0 
  ├── merge-descriptors@1.0.1 
  ├── methods@1.1.2 
  ├─┬ on-finished@2.3.0 
  │ └── ee-first@1.1.1 
  ├── parseurl@1.3.1 
  ├── path-to-regexp@0.1.7 
  ├─┬ proxy-addr@1.1.2 
  │ ├── forwarded@0.1.0 
  │ └── ipaddr.js@1.1.1 
  ├── qs@6.2.0 
  ├── range-parser@1.2.0 
  ├─┬ send@0.14.1 
  │ ├── destroy@1.0.4 
  │ ├─┬ http-errors@1.5.0 
  │ │ ├── inherits@2.0.1 
  │ │ └── setprototypeof@1.0.1 
  │ └── mime@1.3.4 
  ├── serve-static@1.11.1 
  ├─┬ type-is@1.6.13 
  │ └── media-typer@0.3.0 
  ├── utils-merge@1.0.0 
  └── vary@1.1.0 

npm WARN enoent ENOENT: no such file or directory, open '/home/parker/build/HENkaku-webserver/Nodejs/package.json'
npm WARN Nodejs No description
npm WARN Nodejs No repository field.
npm WARN Nodejs No README data
npm WARN Nodejs No license field.
[parker@e73 Nodejs]$ node HENkaku-webservice.js 
module.js:442
    throw err;
    ^

Error: Cannot find module 'request'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/parker/build/HENkaku-webserver/Nodejs/HENkaku-webservice.js:3:15)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
[parker@e73 Nodejs]$ npm install request
/home/parker/build/HENkaku-webserver/Nodejs
└─┬ request@2.74.0 
  ├── aws-sign2@0.6.0 
  ├── aws4@1.4.1 
  ├─┬ bl@1.1.2 
  │ └─┬ readable-stream@2.0.6 
  │   ├── core-util-is@1.0.2 
  │   ├── isarray@1.0.0 
  │   ├── process-nextick-args@1.0.7 
  │   ├── string_decoder@0.10.31 
  │   └── util-deprecate@1.0.2 
  ├── caseless@0.11.0 
  ├─┬ combined-stream@1.0.5 
  │ └── delayed-stream@1.0.0 
  ├── extend@3.0.0 
  ├── forever-agent@0.6.1 
  ├─┬ form-data@1.0.0-rc4 
  │ └── async@1.5.2 
  ├─┬ har-validator@2.0.6 
  │ ├─┬ chalk@1.1.3 
  │ │ ├── ansi-styles@2.2.1 
  │ │ ├── escape-string-regexp@1.0.5 
  │ │ ├─┬ has-ansi@2.0.0 
  │ │ │ └── ansi-regex@2.0.0 
  │ │ ├── strip-ansi@3.0.1 
  │ │ └── supports-color@2.0.0 
  │ ├─┬ commander@2.9.0 
  │ │ └── graceful-readlink@1.0.1 
  │ ├─┬ is-my-json-valid@2.13.1 
  │ │ ├── generate-function@2.0.0 
  │ │ ├─┬ generate-object-property@1.2.0 
  │ │ │ └── is-property@1.0.2 
  │ │ ├── jsonpointer@2.0.0 
  │ │ └── xtend@4.0.1 
  │ └─┬ pinkie-promise@2.0.1 
  │   └── pinkie@2.0.4 
  ├─┬ hawk@3.1.3 
  │ ├── boom@2.10.1 
  │ ├── cryptiles@2.0.5 
  │ ├── hoek@2.16.3 
  │ └── sntp@1.0.9 
  ├─┬ http-signature@1.1.1 
  │ ├── assert-plus@0.2.0 
  │ ├─┬ jsprim@1.3.0 
  │ │ ├── extsprintf@1.0.2 
  │ │ ├── json-schema@0.2.2 
  │ │ └── verror@1.3.6 
  │ └─┬ sshpk@1.9.2 
  │   ├── asn1@0.2.3 
  │   ├── assert-plus@1.0.0 
  │   ├─┬ dashdash@1.14.0 
  │   │ └── assert-plus@1.0.0 
  │   ├── ecc-jsbn@0.1.1 
  │   ├─┬ getpass@0.1.6 
  │   │ └── assert-plus@1.0.0 
  │   ├── jodid25519@1.0.2 
  │   ├── jsbn@0.1.0 
  │   └── tweetnacl@0.13.3 
  ├── is-typedarray@1.0.0 
  ├── isstream@0.1.2 
  ├── json-stringify-safe@5.0.1 
  ├── node-uuid@1.4.7 
  ├── oauth-sign@0.8.2 
  ├── stringstream@0.0.5 
  ├── tough-cookie@2.3.1 
  └── tunnel-agent@0.4.3 

npm WARN enoent ENOENT: no such file or directory, open '/home/parker/build/HENkaku-webserver/Nodejs/package.json'
npm WARN Nodejs No description
npm WARN Nodejs No repository field.
npm WARN Nodejs No README data
npm WARN Nodejs No license field.

Also since this listens on port 80 by default it has to be run with sudo (Not mentioned in the readme)

[parker@e73 Nodejs]$ node HENkaku-webservice.js 
index.html not found, creating
payload.js not found, creating
Base payload not found, creating
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: listen EACCES 0.0.0.0:80
    at Object.exports._errnoException (util.js:1008:11)
    at exports._exceptionWithHostPort (util.js:1031:20)
    at Server._listen2 (net.js:1240:19)
    at listen (net.js:1289:10)
    at Server.listen (net.js:1385:5)
    at EventEmitter.listen (/home/parker/build/HENkaku-webserver/Nodejs/node_modules/express/lib/application.js:617:24)
    at Object.<anonymous> (/home/parker/build/HENkaku-webserver/Nodejs/HENkaku-webservice.js:366:18)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
[parker@e73 Nodejs]$ sudo node HENkaku-webservice.js 
index.html not found, creating
payload.js not found, creating
Base payload not found, creating
Henkaku local service listening on http://:::80
Successfully created base payload
sl1pkn07 commented 7 years ago

ugly solution is remove $/HOME/node_modules and link with ln -s /usr/lib/node_modules $HOME/node_modules

for change the port, you need change the 80 in the line https://github.com/meetpatty/HENkaku-webserver/blob/master/HENkaku-webservice.js#L138 with the port desired

greetings