Https://github.com/cambecc/air
1, follow the steps given in GitHub, execute to NPM install, the project Package.json contains the version of the package to be installed, but when installed,PG and ICONV module prompts GYP rebuild error , first suspect version of the issue ( uninstall Nodejshttp://www.cnblogs.com/snandy/p/4418615.html, and then download the version you want ), but to adjust the version to the Package.json hint version or not, so clone a copy, the Package.json file removed, one of the NPM install, PG and ICONV installation through (the specific problem is unclear, only with this stupid method), there is a second problem.
2, express 4 in the module compared to express 3 are out alone, need to be installed separately,EXPRESS3 and 42 of the difference is quite large . At this point, you need to develop a version of the installation Express,npm Install [email protected], this command.
3. Enter node server.js 8080 postgres://postgres:[email protected]:5432/air www.kankyo.metro.tokyo.jp in terminal , prompting for a denial of connection problem (
2015-11-08t06:53:37.516z-error:error:connect econnrefused
At Exports._errnoexception (util.js:746:11)
At Tcpconnectwrap.afterconnect as OnComplete
Potentially unhandled rejection [2] error:connect econnrefused
At Exports._errnoexception (util.js:746:11)
At Tcpconnectwrap.afterconnect as OnComplete
), do not know where the problem is? Back to the Webstorm, the command was broken down (The process is accepting parameters ) to the file directly assigned, output two get (
2015-11-08t06:53:37.493z-info:get: www.taiki.kankyo.metro.tokyo.jp/cgi-bin/bunpu1/p160.cgi?no2===1==2====2=
2015-11-08t06:53:37.499z-info:get: www.taiki.kankyo.metro.tokyo.jp/cgi-bin/bunpu1/p160.cgi?no2===2==2====2=
set breakpoints debugging and Log.info () output , and finally determined that the deny connection occurs when you request data from the Web site
Again to search Nodejs in the Http.get method of the problem, inadvertently see the URL in the Get method to add the HTTP header (http://www.cnblogs.com/vimsk/archive/2012/09/22/ 2697806.html), while himself without adding (during which himself had put www.taiki.kankyo.metro.tokyo.jp/cgi-bin/bunpu1/p160.cgi?no2===1==2=== =2= is placed in the browser address bar to access, the content appears, but the browser is the default omitted HTTP header, I ignored the problem ). Then add the HTTP (node server.js 8080 postgres://postgres:[email Protected]:5432/air/http/ WWW.TAIKI.KANKYO.METRO.TOKYO.JP/CGI-BIN/BUNPU1), normal operation.
4, thinking: encountered problems can always be solved , the specific ideas are mainly three:
- Calmly look at the difference between the parameters you entered and the parameters you entered when the other person executed it , which is sometimes quite a pit .
- See What the wrong hint is.
- experience, imagination, and conjecture tell us where it appears,
- Set Breakpoints Debugging and alert, console.log output position , so step by step down to see where the specific wrong?
Several problems and solutions encountered in the GitHub Air project (Nodejs majority)