Planet of NCCUCS
adobe photoshop 8.0 warez Adobe Premiere Pro CS5 can t reinstall adobe creative suite download adobe photoshop 8 0 cs Adobe Illustrator CS5 adobe premiere pro 1.5 serial key adobe acrobat reader 6.0 free Adobe Dreamweaver CS5 adobe course indesign software adobe photoshop free cursive fonts Adobe Photoshop CS5 Extended adobe photoshop elements 4 help sound adobe photoshop logos Adobe Creative Suite 5 Master Collection adobe creative suite torrents adobe photoshop and trial version Adobe Acrobat 9 Pro Extended adobe photoshop shape tools adobe photoshop free trial software Adobe Contribute CS5 wartz adobe acrobat adobe creative suite 2 academic Adobe Indesign CS5 adobe acrobat approval adobe premiere preview download Adobe Flash Catalyst CS5 602 acrobat adobe reader update adobe acrobat 7 reader update Adobe Flex Builder 3 Pro opening pps in adobe photoshop

nodejs : require lib but remember DO NOT add an extension

作者:huge on 四月 19, 2010 Posted in RSS | | 觀看文章來源

I follow some example wrote on somebody’s(!@$!@$#@!$) blog and I had such issue :


Error: Cannot find module ‘/sys’
at loadModule (node.js:492:15)
at require (node.js:618:12)
at Object. (/Users/huge/test:3:11)
at Module._compile (node.js:639:23)
at node.js:667:20
at fs:52:23
at node.js:748:9

#!/usr/local/bin/node

var sys = require("/sys.js"), http = require("/http.js");http.createServer(function (req, res){        setTimeout(function() {                res.sendHeader(200, {"Content-Type": "text/plain"});                res.sendBody("Hello XD");                res.finish();        }, 2000);}).listen(8000);

sys.puts("Server running at http://localhost:8000");

This error raised because I try to add extension while requiring a library.
Shortly speaking,
require(”sys”) is correct
require(”sys.js”) or require(”/sys.js”) is incorrect

Time passed and code changed :P, please use example wrote below for your testing

#!/usr/local/bin/node

var sys = require("sys"),     http = require("http");

http.createServer(function (req, res){        setTimeout(function() {                res.writeHead(200, {"Content-Type": "text/plain"});                res.end("Hello World\n");        }, 2000);}).listen(8000);

Thanks for friends from irc node.js channel :)

:,

讀過本文的讀者, 也對以下文章有興趣

No comments for this entry yet...

Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

最新文章

照片

R0012028R0012036R0013553R0013551R0013550R0013549R0013560R0013558R0013569R0013561R0013570R0013571R0013580R0013581R0013556R0013567R0013563R0013572R0011783R0012312