Open sunnyhd opened 12 years ago
I was having problems installing node-jsonsp since the version of node-yajl (a dependency) could not build on Node 0.8. I forked node-yajl and node-jsonsp to fix this and now it installs fine for me.
@sunnyhd This problem doesn't look to be the same as what I was experiencing (and you are running Node 0.6). It may be worth trying again with the updated dependency, however, I will continue to explore whatever is going on here.
Still got problems.
root@wiregate343:/home/user/homeintouch# npm install npm http GET https://registry.npmjs.org/async/0.1.22 npm http GET https://registry.npmjs.org/carrier/0.1.7 npm http GET https://registry.npmjs.org/express/2.5.9 npm http GET https://registry.npmjs.org/request/2.9.203 npm http GET https://registry.npmjs.org/socket.io/0.9.4 npm http GET https://registry.npmjs.org/jade/0.24.0 npm http GET https://registry.npmjs.org/dirty/0.9.6 npm http GET https://registry.npmjs.org/stitch/0.3.3 npm http GET https://registry.npmjs.org/mongoose/2.7.1 npm ERR! git clone git://github.com/scttnlsn/node-jsonsp.git Initialized empty Git repository in /tmp/npm-1345220247868/1345220247868-0.0006833022926002741/.git/ npm ERR! git clone git://github.com/scttnlsn/node-jsonsp.git npm ERR! git clone git://github.com/scttnlsn/node-jsonsp.git fatal: Unable to look up github.com (port 9418) (Name or service not known)
npm ERR! Error: git "clone" "git://github.com/scttnlsn/node-jsonsp.git" "/tmp/npm-1345220247868/1345220247868-0.0006833022926002741"
failed with 128
npm ERR! at ChildProcess.git "clone" "git://github.com/scttnlsn/node-jsonsp.git" "/tmp/npm-1345220247868/1345220247868-0.0006833022926002741"
failed with 128
npm http GET https://registry.npmjs.org/nettle/0.0.4
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/user/homeintouch/npm-debug.log
npm not ok
Changed the node-jsonsp
URL in package.json
to point to a tarball instead of the Git repo. Can you try again?
root@wiregate343:/home/user/homeintouch# npm install npm http GET https://registry.npmjs.org/async/0.1.22 npm http GET https://registry.npmjs.org/carrier/0.1.7 npm http GET https://registry.npmjs.org/express/2.5.9 npm http GET https://registry.npmjs.org/request/2.9.203 npm http GET https://registry.npmjs.org/socket.io/0.9.4 npm http GET https://registry.npmjs.org/jade/0.24.0 npm http GET https://registry.npmjs.org/dirty/0.9.6 npm http GET https://registry.npmjs.org/stitch/0.3.3 npm http GET https://registry.npmjs.org/mongoose/2.7.1 npm http GET https://registry.npmjs.org/nettle/0.0.4
npm ERR! Error: getaddrinfo ENOENT npm ERR! at errnoException (dns.js:31:11) npm ERR! at Object.onanswer as oncomplete npm ERR! You may report this log at: npm ERR! http://github.com/isaacs/npm/issues npm ERR! or email it to: npm ERR! npm-@googlegroups.com npm ERR! npm ERR! System Linux 2.6.32-wiregate-1.31 npm ERR! command "node" "/root/.nvm/v0.6.18/bin/npm" "install" npm ERR! cwd /home/user/homeintouch npm ERR! node -v v0.6.18 npm ERR! npm -v 1.1.21 npm ERR! syscall getaddrinfo npm ERR! code ENOTFOUND npm ERR! message getaddrinfo ENOENT npm ERR! errno {} npm http GET http://github.com/scttnlsn/node-jsonsp/tarball/master npm ERR! failed to fetch http://github.com/scttnlsn/node-jsonsp/tarball/master npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/user/homeintouch/npm-debug.log npm not ok root@wiregate343:/home/user/homeintouch#
Looks like this might be the problem:
user@wiregate343:~$ ping github.com
ping: unknown host github.com
Weekend!
root@wiregate343:/home/user/homeintouch# npm install npm http GET http://github.com/scttnlsn/node-jsonsp/tarball/master npm http 200 http://github.com/scttnlsn/node-jsonsp/tarball/master npm http GET https://github.com/scttnlsn/node-yajl/tarball/master npm http 200 https://github.com/scttnlsn/node-yajl/tarball/master
yajl@0.6.1 install /home/user/homeintouch/node_modules/jsonsp/node_modules/yajl node-gyp rebuild
info it worked if it ends with ok
spawn python [ '/root/.node-gyp/0.6.18/tools/gyp_addon',
'binding.gyp',
'-I/home/user/homeintouch/node_modules/jsonsp/node_modules/yajl/build/config.gypi',
'-f',
'make' ]
spawn make [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory /home/user/homeintouch/node_modules/jsonsp/node_modules/yajl/build' CXX(target) Release/obj.target/yajl/src/yajl.o make: g++: Kommando nicht gefunden make: *** [Release/obj.target/yajl/src/yajl.o] Fehler 127 make: Leaving directory
/home/user/homeintouch/node_modules/jsonsp/node_modules/yajl/build'
ERR! Error: make
failed with exit code: 2
at ChildProcess.onExit (/root/.nvm/v0.6.18/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
at ChildProcess.emit (events.js:70:17)
at maybeExit (child_process.js:362:16)
at Process.onexit (child_process.js:398:5)
ERR! not ok
npm ERR! yajl@0.6.1 install: node-gyp rebuild
npm ERR! sh "-c" "node-gyp rebuild"
failed with 1
npm ERR!
npm ERR! Failed at the yajl@0.6.1 install script.
npm ERR! This is most likely a problem with the yajl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls yajl
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 2.6.32-wiregate-1.31
npm ERR! command "node" "/root/.nvm/v0.6.18/bin/npm" "install"
npm ERR! cwd /home/user/homeintouch
npm ERR! node -v v0.6.18
npm ERR! npm -v 1.1.21
npm ERR! code ELIFECYCLE
npm ERR! message yajl@0.6.1 install: node-gyp rebuild
npm ERR! message sh "-c" "node-gyp rebuild"
failed with 1
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/user/homeintouch/npm-debug.log
npm not ok
That last error is likely because the command "g++" is still not installed.
Tried to install on Ubuntu in Virtualbox
kb@kb-VirtualBox:~$ cd homeintouch kb@kb-VirtualBox:~/homeintouch$ ls app data node_modules package.json README.md client lib npm-debug.log public server.js kb@kb-VirtualBox:~/homeintouch$ sudo npm install [sudo] password for kb: npm http GET http://github.com/scttnlsn/node-jsonsp/tarball/master npm http 200 http://github.com/scttnlsn/node-jsonsp/tarball/master npm http GET https://github.com/scttnlsn/node-yajl/tarball/master npm http 200 https://github.com/scttnlsn/node-yajl/tarball/master
yajl@0.6.1 install /home/kb/homeintouch/node_modules/jsonsp/node_modules/yajl node-gyp rebuild
gyp http GET http://nodejs.org/dist/v0.8.8/node-v0.8.8.tar.gz
gyp http 200 http://nodejs.org/dist/v0.8.8/node-v0.8.8.tar.gz
make: Gehe in Verzeichnis '/home/kb/homeintouch/node_modules/jsonsp/node_modules/yajl/build'
CXX(target) Release/obj.target/yajl/src/yajl.o
In file included from ../src/yajl.cc:34:0:
../src/tree.hh:22:28: schwerwiegender Fehler: yajl/yajl_tree.h: Datei oder Verzeichnis nicht gefunden
Kompilierung beendet.
make: *\ [Release/obj.target/yajl/src/yajl.o] Fehler 1
make: Verlasse Verzeichnis '/home/kb/homeintouch/node_modules/jsonsp/node_modules/yajl/build'
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:219:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:91:17)
gyp ERR! stack at Process._handle.onexit (child_process.js:674:10)
gyp ERR! System Linux 3.0.0-12-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/kb/homeintouch/node_modules/jsonsp/node_modules/yajl
gyp ERR! node -v v0.8.8
gyp ERR! node-gyp -v v0.6.7
gyp ERR! not ok
npm ERR! yajl@0.6.1 install: node-gyp rebuild
npm ERR! sh "-c" "node-gyp rebuild"
failed with 1
npm ERR!
npm ERR! Failed at the yajl@0.6.1 install script.
npm ERR! This is most likely a problem with the yajl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls yajl
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.0.0-12-generic npm ERR! command "node" "/usr/local/bin/npm" "install" npm ERR! cwd /home/kb/homeintouch npm ERR! node -v v0.8.8 npm ERR! npm -v 1.1.59 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/kb/homeintouch/npm-debug.log npm ERR! not ok code 0 kb@kb-VirtualBox:~/homeintouch$
Maybe it makes more sense to look into using a different JSON stream parser since this module is causing such trouble. Perhaps https://github.com/dominictarr/JSONStream as it is pure JavaScript (no native stuff to compile)?
Can You change the module at this point?
Removed the jsonsp dependency. Parsing the newline delimited XBMC response stream by hand.
Get this error message after removing the jsonsp module when importing the data from XBMC.
[SyntaxError: Unexpected token {] xbmc error: SyntaxError: Unexpected token { importer:error [SyntaxError: Unexpected token {] [SyntaxError: Unexpected token {] xbmc error: SyntaxError: Unexpected token {
It looks like this is happening because two JSON messages are being returned from the HIT server without a newline separating them.
Sure? When importiing to the db it only misses the TV Shows and I get the message: [SyntaxError: Unexpected token {] xbmc error: SyntaxError: Unexpected token { importer:error [SyntaxError: Unexpected token {]
Songs doesnt get imported either anymore.
Reverted things back to JSONSP for now. I will debug this on another branch so nothing breaks.
I get the following error now on my Mac:
xbmc-wohnen:homeintouch kb$ sudo npm install npm http GET http://github.com/scttnlsn/node-jsonsp/tarball/master npm http 200 http://github.com/scttnlsn/node-jsonsp/tarball/master npm http GET https://github.com/scttnlsn/node-yajl/tarball/master npm http 200 https://github.com/scttnlsn/node-yajl/tarball/master
yajl@0.6.1 install /Users/kb/Dropbox/homeintouch/node_modules/jsonsp/node_modules/yajl node-gyp rebuild
info it worked if it ends with ok spawn python [ '/Users/kb/.node-gyp/0.6.15/tools/gyp_addon', 'binding.gyp', '-I/Users/kb/Dropbox/homeintouch/node_modules/jsonsp/node_modules/yajl/build/config.gypi', '-f', 'make' ] ERR! Error: not found: make at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:43:28) at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:46:29) at Object.oncomplete (/usr/local/lib/node_modules/npm/node_modules/which/which.js:57:16) ERR! not ok
npm ERR! yajl@0.6.1 install: node-gyp rebuild
npm ERR! sh "-c" "node-gyp rebuild"
failed with 1
npm ERR!
npm ERR! Failed at the yajl@0.6.1 install script.
npm ERR! This is most likely a problem with the yajl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls yajl
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Darwin 12.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/kb/Dropbox/homeintouch
npm ERR! node -v v0.6.15
npm ERR! npm -v 1.1.16
npm ERR! code ELIFECYCLE
npm ERR! message yajl@0.6.1 install: node-gyp rebuild
npm ERR! message sh "-c" "node-gyp rebuild"
failed with 1
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/kb/Dropbox/homeintouch/npm-debug.log
npm not ok
Was a problem after updating to Mountain Lion. Had to fix the Homebrew installation.
Can you install this on the Linux machine as well?
I get this error message on the Linux box:
root@wiregate343:/home/user/homeintouch# npm install npm http GET http://github.com/scttnlsn/node-jsonsp/tarball/master npm http 200 http://github.com/scttnlsn/node-jsonsp/tarball/master npm http GET https://github.com/scttnlsn/node-yajl/tarball/master npm http 200 https://github.com/scttnlsn/node-yajl/tarball/master
yajl@0.6.1 install /home/user/homeintouch/node_modules/jsonsp/node_modules/yajl node-gyp rebuild
info it worked if it ends with ok
spawn python [ '/root/.node-gyp/0.6.18/tools/gyp_addon',
'binding.gyp',
'-I/home/user/homeintouch/node_modules/jsonsp/node_modules/yajl/build/config.gypi',
'-f',
'make' ]
spawn make [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory /home/user/homeintouch/node_modules/jsonsp/node_modules/yajl/build' CXX(target) Release/obj.target/yajl/src/yajl.o make: g++: Kommando nicht gefunden make: *** [Release/obj.target/yajl/src/yajl.o] Fehler 127 make: Leaving directory
/home/user/homeintouch/node_modules/jsonsp/node_modules/yajl/build'
ERR! Error: make
failed with exit code: 2
at ChildProcess.onExit (/root/.nvm/v0.6.18/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
at ChildProcess.emit (events.js:70:17)
at maybeExit (child_process.js:362:16)
at Process.onexit (child_process.js:398:5)
ERR! not ok
npm ERR! yajl@0.6.1 install: node-gyp rebuild
npm ERR! sh "-c" "node-gyp rebuild"
failed with 1
npm ERR!
npm ERR! Failed at the yajl@0.6.1 install script.
npm ERR! This is most likely a problem with the yajl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls yajl
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 2.6.32-wiregate-1.31
npm ERR! command "node" "/root/.nvm/v0.6.18/bin/npm" "install"
npm ERR! cwd /home/user/homeintouch
npm ERR! node -v v0.6.18
npm ERR! npm -v 1.1.21
npm ERR! code ELIFECYCLE
npm ERR! message yajl@0.6.1 install: node-gyp rebuild
npm ERR! message sh "-c" "node-gyp rebuild"
failed with 1
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/user/homeintouch/npm-debug.log
npm not ok
root@wiregate343:/home/user/homeintouch#
Okay. If you're unable to install g++ (required for the node-jsonsp install) then I can continue exploring alternatives to node-jsonsp.
g++ is installed on the Linux Box as well as on the Ubuntu VM. The problem must be something else. The frontend developers do have the same problems installing that module so lets implement an alternative which works out of the box.
user@wiregate343:~$ g++
-bash: g++: command not found
user@wiregate343:~$ sudo g++
[sudo] password for user:
sudo: g++: command not found
Regardless, it would be nice to have a solution that did not require native extensions be compiled.
Should be int the gcc package but regardless as you said...
There are still occasions when two XBMC JSON responses are being returned from the HIT server without a newline separating them. This isn't a problem when using node-jsonsp
since it keeps track of where it is in the JSON object as data is streaming in and knows when an entire object has been received. When trying to do this by hand I buffer the incoming data until there's a newline, then parse the buffer as JSON. Thus when a newline is missing between two JSON objects we're trying to parse something like { ... }{ ... }
and the JSON parser fails with a SyntaxError: Unexpected token {
. Since writing a streaming JSON parser in JavaScript is definitely beyond the scope of this project we need to either:
node-yajl
(on which node-jsonsp
depends) install processThat only happens when sending the play/pause command as far as know. XBMC returns that in one line:
{"jsonrpc":"2.0","method":"Player.OnPause","params":{"data":{"item":{"id":36,"type":"episode"},"player":{"playerid":1,"speed":0}},"sender":"xbmc"}}{"id":"1","jsonrpc":"2.0","result":{"speed":0}}
Also happening for me when importing music and movie data.
Have you tried connecting directly to XBMC on port 9090 to check if the issue is caused by XBMC itself or when routed to the HitServer.
It seems like XBMC doesn't append a newline at all. How does the HIT server parse each message individually?
Here's what I tried:
ssh user@marisamigliazzi.selfhost.eu
nc 192.168.2.20 9090
{"jsonrpc":"2.0","method":"VideoLibrary.GetMovies","params":{},"id":1}
{"id":1,"jsonrpc":"2.0","result":{"limits":{"end":186,"start":0,"total":186},"movies":[...]}}
No newline at the end of the response- the cursor was left after the last closing brace.
Its counting brackets. There were some changes. Did the situation change in the meantime or are you still facing the same problems.
Same problem...perhaps we should count brackets on the Node side as well. Does the HIT server take into account brackets that might be inside of the JSON content? i.e.
{ "description": "Here's a bracket that shouldn't be counted: {" }
newtext = ReplaceAll(rl, "\"+chr(34),"") newtext = RxReplace(chr(34)+"._?"+chr(34), "", newtext, "s r g ") numopen = instr(newtext,"{") numclosed = instr(newtext,"}") while numopen >numclosed and numopen > 0 and thetime-starttime < 3 //timeout 3 seconds rl=rl +TCPreadmsg("xbmc") newtext = ReplaceAll(rl, "\"+chr(34),"") newtext = RxReplace(chr(34)+".?"+chr(34), "", newtext, "s r g ") numopen = instr(newtext,"{") numclosed = instr(newtext,"}")
Next try on Ubuntu 12.04
kb@kb-VirtualBox:~/Desktop/scttn$ sudo npm install npm http GET http://github.com/scttnlsn/node-jsonsp/tarball/master npm http 200 http://github.com/scttnlsn/node-jsonsp/tarball/master npm http GET https://github.com/scttnlsn/node-yajl/tarball/master npm http 200 https://github.com/scttnlsn/node-yajl/tarball/master
yajl@0.6.1 preinstall /home/kb/Desktop/scttn/node_modules/jsonsp/node_modules/yajl node-waf clean || (exit 0); node-waf configure build
Nothing to clean (project not configured)
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr
Checking for header yajl/yajl_version.h : yes
'configure' finished successfully (0.378s)
Waf: Entering directory /home/kb/Desktop/scttn/node_modules/jsonsp/node_modules/yajl/build' [1/4] cxx: src/yajl.cc -> build/Release/src/yajl_1.o In file included from ../src/yajl.cc:33:0: ../src/handle.hh:35:35: fatal error: node/node_object_wrap.h: No such file or directory compilation terminated. Waf: Leaving directory
/home/kb/Desktop/scttn/node_modules/jsonsp/node_modules/yajl/build'
Build failed: -> task failed (err #1):
{task: cxx yajl.cc -> yajl_1.o}
npm ERR! error installing yajl@0.6.1
npm ERR! error installing jsonsp@0.1.0
npm ERR! yajl@0.6.1 preinstall: node-waf clean || (exit 0); node-waf configure build
npm ERR! sh "-c" "node-waf clean || (exit 0); node-waf configure build"
failed with 1
npm ERR!
npm ERR! Failed at the yajl@0.6.1 preinstall script.
npm ERR! This is most likely a problem with the yajl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-waf clean || (exit 0); node-waf configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls yajl
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 3.2.0-29-generic-pae
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /home/kb/Desktop/scttn
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! code ELIFECYCLE
npm ERR! message yajl@0.6.1 preinstall: node-waf clean || (exit 0); node-waf configure build
npm ERR! message sh "-c" "node-waf clean || (exit 0); node-waf configure build"
failed with 1
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/kb/Desktop/scttn/npm-debug.log
npm not ok
npm http GET https://github.com/EqualMedia/node-yajl/tarball/node-0.6 npm http 200 https://github.com/EqualMedia/node-yajl/tarball/node-0.6
Checking for program g++ or c++ : /usr/bin/g++ Checking for program cpp : /usr/bin/cpp Checking for program ar : /usr/bin/ar Checking for program ranlib : /usr/bin/ranlib Checking for g++ : ok
Checking for node path : not found Checking for node prefix : ok /usr Checking for header yajl/yajl_version.h : yes 'configure' finished successfully (4.700s) Waf: Entering directory
/home/pi/hit/node_modules/jsonsp/node_modules/yajl/build' [1/4] cxx: src/yajl.cc -> build/Release/src/yajl_1.o In file included from ../src/yajl.cc:33:0: ../src/handle.hh:35:35: fatal error: node/node_object_wrap.h: No such file or directory compilation terminated. Waf: Leaving directory
/home/pi/hit/node_modules/jsonsp/node_modules/yajl/build' Build failed: -> task failed (err #1): {task: cxx yajl.cc -> yajl_1.o} npm ERR! error installing yajl@0.6.1 npm ERR! error installing jsonsp@0.1.0npm ERR! yajl@0.6.1 install:
node-waf configure build
npm ERR!sh "-c" "node-waf configure build"
failed with 1 npm ERR! npm ERR! Failed at the yajl@0.6.1 install script. npm ERR! This is most likely a problem with the yajl package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-waf configure build npm ERR! You can get their info via: npm ERR! npm owner ls yajl npm ERR! There is likely additional logging output above. npm ERR! npm ERR! System Linux 3.1.9adafruit+ npm ERR! command "node" "/usr/bin/npm" "install" npm ERR! cwd /home/pi/hit npm ERR! node -v v0.6.19 npm ERR! npm -v 1.1.4 npm ERR! code ELIFECYCLE npm ERR! message yajl@0.6.1 install:node-waf configure build
npm ERR! messagesh "-c" "node-waf configure build"
failed with 1 npm ERR! errno {} npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/pi/hit/npm-debug.log npm not ok