node-http-proxy icon indicating copy to clipboard operation
node-http-proxy copied to clipboard

Examples: <not work>

Open brakdag opened this issue 5 years ago • 5 comments
trafficstars

Examples:

I try with basic_proxy.js May be, hard requariments of unnecessary dependences.

I walk in this steps.

git clone https://github.com/http-party/node-http-proxy.git
npm install
node ./examples/http/basic-proxy.js

its fails, y see in the file basic-proxy require('colors') and require('util'), and then i install it

npm i -s colors util

Next, btw it fails,

util.puts(welcome.rainbow.bold);
     ^

TypeError: util.puts is not a function
    at Object.<anonymous> (D:\Lamiwet\proxy\node-http-proxy\examples\http\basic-proxy.js:41:6)
    at Module._compile (internal/modules/cjs/loader.js:1185:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
    at Module.load (internal/modules/cjs/loader.js:1034:32)
    at Function.Module._load (internal/modules/cjs/loader.js:923:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

brakdag avatar May 17 '20 11:05 brakdag

Which version of node are you using? util.puts has been deprecated since v0.11.3 and finally removed in v12.x

Extract from v11.x documentation:

util.puts([...strings])

Deprecated: Use console.log() instead.

PierreMage avatar Jun 05 '20 22:06 PierreMage

I'm not using utils.puts sorry, the code of your exampes uses utls.puts

brakdag avatar Jun 06 '20 12:06 brakdag

The example basic_proxy.js uses util.puts.

Couldn't find util.puts in node-util, the one installed by npm i -s util. So that wouldn't fix the error TypeError: util.puts is not a function.

The PR, Fix examples for node v12.x, should fix the error when merged. In the meantime you can manually edit the file and replace util.puts with console.log.

PierreMage avatar Jun 06 '20 20:06 PierreMage

Ahh, ok, thanks

brakdag avatar Jun 07 '20 20:06 brakdag

reverse-proxy.js has it too

asheroto avatar Aug 18 '22 09:08 asheroto