Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make server exception for the latest Node.js (v0.12.0) #140

Closed
weixsong opened this issue Apr 2, 2015 · 1 comment
Closed

make server exception for the latest Node.js (v0.12.0) #140

weixsong opened this issue Apr 2, 2015 · 1 comment

Comments

@weixsong
Copy link
Contributor

weixsong commented Apr 2, 2015

I'm using the latest Node.js (v0.12.0) to run the unit test cases by make server, but it report an exception, then I changed to Node.js (v0.10.0), when using make server, it still report an exception.

The following is detailed information.

  1. When using Node.js v0.10.0:
    make server run, but when open the link by browser it will report an excepiton.

songwei@songwei-ThinkPad-T410:/WeiSONG/work/lunr.js/lunr.js$ node -v
v0.10.0
songwei@songwei-ThinkPad-T410:
/WeiSONG/work/lunr.js/lunr.js$ make test
Starting test server at http://localhost:32423
Took 74ms to run 301 tests. 301 passed, 0 failed.
songwei@songwei-ThinkPad-T410:~/WeiSONG/work/lunr.js/lunr.js$ make server
/usr/local/bin/node server.js 3000

Server listening on 3000

GET /test
/home/songwei/WeiSONG/work/lunr.js/lunr.js/server.js:32
exists(path, function(exists){
^
TypeError: undefined is not a function
at Server. (/home/songwei/WeiSONG/work/lunr.js/lunr.js/server.js:32:3)
at Server.emit (events.js:110:17)
at HTTPParser.parserOnIncoming as onIncoming
at HTTPParser.parserOnHeadersComplete (_http_common.js:111:23)
at Socket.socketOnData (_http_server.js:343:22)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at TCP.onread (net.js:529:20)
make: *** [server] Error 1

  1. Then I changed to Node.js v0.12.0, make server runs, but when open the link in browser, it report an exception:
    songwei@songwei-ThinkPad-T410:/WeiSONG/work/lunr.js/lunr.js$ nvm use system
    Now using system version of node: v0.12.0.
    songwei@songwei-ThinkPad-T410:
    /WeiSONG/work/lunr.js/lunr.js$ node -v
    v0.12.0
    songwei@songwei-ThinkPad-T410:/WeiSONG/work/lunr.js/lunr.js$ make test
    Starting test server at http://localhost:32423
    Took 74ms to run 301 tests. 301 passed, 0 failed.
    songwei@songwei-ThinkPad-T410:
    /WeiSONG/work/lunr.js/lunr.js$ make server
    /usr/local/bin/node server.js 3000

    Server listening on 3000

    GET /test
    /home/songwei/WeiSONG/work/lunr.js/lunr.js/server.js:32
    exists(path, function(exists){
    ^
    TypeError: undefined is not a function
    at Server. (/home/songwei/WeiSONG/work/lunr.js/lunr.js/server.js:32:3)
    at Server.emit (events.js:110:17)
    at HTTPParser.parserOnIncoming as onIncoming
    at HTTPParser.parserOnHeadersComplete (_http_common.js:111:23)
    at Socket.socketOnData (_http_server.js:343:22)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)
    at TCP.onread (net.js:529:20)
    make: *** [server] Error 1

Then, I looked the documents of Node.js, it seems that from some specified version, 'exists' function is remove from 'path' module, and moved to 'file' module.
Then, I modified the code in "server.js", it works for Node.js v0.12.0:
songwei@songwei-ThinkPad-T410:/WeiSONG/work/lunr.js/lunr.js$ node -v
v0.12.0
songwei@songwei-ThinkPad-T410:
/WeiSONG/work/lunr.js/lunr.js$ make server
/usr/local/bin/node server.js 3000

Server listening on 3000

GET /test
GET /test/env/jquery.js
GET /test/env/augment.min.js
GET /test/env/qunit.js
GET /test/env/qunit.css
GET /lib/lunr.js
GET /lib/utils.js
GET /lib/tokenizer.js
GET /lib/pipeline.js
GET /lib/vector.js
GET /lib/sorted_set.js
GET /lib/event_emitter.js
.....

And, it alsl work in Node.js v0.10.0:

songwei@songwei-ThinkPad-T410:/WeiSONG/work/lunr.js/lunr.js$ nvm use 0.10.0
Now using node v0.10.0
songwei@songwei-ThinkPad-T410:
/WeiSONG/work/lunr.js/lunr.js$ node -v
v0.10.0
songwei@songwei-ThinkPad-T410:/WeiSONG/work/lunr.js/lunr.js$ make test
Starting test server at http://localhost:32423
Took 74ms to run 301 tests. 301 passed, 0 failed.
songwei@songwei-ThinkPad-T410:
/WeiSONG/work/lunr.js/lunr.js$ make server
/usr/local/bin/node server.js 3000

Server listening on 3000

GET /test
GET /test/env/jquery.js
GET /test/env/augment.min.js
GET /test/env/qunit.js
GET /test/env/qunit.css
GET /lib/lunr.js
GET /lib/utils.js
GET /lib/tokenizer.js

@olivernn
Copy link
Owner

olivernn commented Apr 9, 2015

fixed and released in 0.5.8, let me know if there are any further issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants