pkrumins / node-video

A node.js module for streaming and recording HTML5 Theora videos
http://www.catonmat.net
202 stars 31 forks source link

Can't require node-video module #7

Open Rayzen opened 12 years ago

Rayzen commented 12 years ago

I'm running on Mac OS X 10.6, and i'm trying to create a small test server with node.js to encode video receiving frames from a client, but when I require the video module with the code "var myVideo = require("video")" it throws the error ("Can't find module 'video').... i've installed node-video with npm, installed libtheora and configured the build with "node-waf configure build"... I've tried to create even the NODE_PATH env, but it thorws another error (Can't load shered library)..

What's wrong??

pdeschen commented 12 years ago

@Rayzen which library can't be found? Full output would be nice. Technically you don't to hand waf compile the module since it should be done for you through npm. Is libtheora in your library path? Doing node-waf did successfully compile the module?

Rayzen commented 12 years ago

Here is what i've done:

*downloaded source file of libogg, libvorbis and libtheora and then I ran for each of them $ ./configure $ make $ sudo make install

then I've reinstalled the video module this way $ npm install video

which output is

"npm http GET https://registry.npmjs.org/video npm http 304 https://registry.npmjs.org/video

video@2.0.0 install /Users/path/to/my/project/node_modules/video node-waf configure build

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/local Checking for library ogg : yes Checking for library theoradec : yes Checking for library theoraenc : yes 'configure' finished successfully (0.239s) Waf: Entering directory /Users/path/to/myt/project/node_modules/video/build' [1/8] cxx: src/common.cpp -> build/Release/src/common_1.o [2/8] cxx: src/video_encoder.cpp -> build/Release/src/video_encoder_1.o [3/8] cxx: src/fixed_video.cpp -> build/Release/src/fixed_video_1.o [4/8] cxx: src/stacked_video.cpp -> build/Release/src/stacked_video_1.o [5/8] cxx: src/async_stacked_video.cpp -> build/Release/src/async_stacked_video_1.o ../src/async_stacked_video.cpp: In static member function ‘static void AsyncStackedVideo::EIO_Encode(eio_req*)’: ../src/async_stacked_video.cpp:423: warning: format ‘%d’ expects type ‘int’, but argument 5 has type ‘size_t’ ../src/async_stacked_video.cpp:453: warning: format ‘%d’ expects type ‘int’, but argument 5 has type ‘size_t’ [6/8] cxx: src/utils.cpp -> build/Release/src/utils_1.o [7/8] cxx: src/module.cpp -> build/Release/src/module_1.o [8/8] cxx_link: build/Release/src/common_1.o build/Release/src/video_encoder_1.o build/Release/src/fixed_video_1.o build/Release/src/stacked_video_1.o build/Release/src/async_stacked_video_1.o build/Release/src/utils_1.o build/Release/src/module_1.o -> build/Release/video.node ld: warning: directory '/lib' following -L not found ld: warning: directory '/usr/local/libogg/lib' following -L not found ld: warning: directory '/usr/local/pkg/libogg/lib' following -L not found ld: warning: directory '/usr/local/pkg/libogg-1.2.0/lib' following -L not found ld: warning: directory '/usr/local/libtheora/lib' following -L not found ld: warning: directory '/usr/local/pkg/libtheora/lib' following -L not found ld: warning: directory '/usr/local/pkg/libtheora-1.1.1/lib' following -L not found Waf: Leaving directory/Users/path/to/myt/project/node_modules/video/build' 'build' finished successfully (1.710s) video@2.0.0 ./node_modules/video "

Then I noticed that the main field in the package.json is wrong, because it values 'video' and doesn't point to any app.node, and corrected it with the right path (build/Release/video.node) and then when I start the server it gives me this output:

$ node index.js

node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: Unable to load shared library /Users/path/to/my/project/node_modules/video/build/Release/video.node at Object..node (module.js:472:11) at Module.load (module.js:348:31) at Function._load (module.js:308:12) at Module.require (module.js:354:17) at require (module.js:370:17) at Object. (/Users/path/to/my/project/requestHandlers.js:4:15) at Module._compile (module.js:441:26) at Object..js (module.js:459:10) at Module.load (module.js:348:31) at Function._load (module.js:308:12)

On my arch linux fixing the package.json make the module load correctly...

I think the problem is during the linking phase, when it print " ld: warning: directory '/lib' following -L not found " (and so for other directories as you can see) but i really don't know why it does so..

Rayzen commented 12 years ago

a friend of mine, running OS X 10.7 has done the same procedure, gets the same output messages, but on his mac all works fine...

Rayzen commented 12 years ago

Ok, i found it.. it was a bug of node.js... i noticed that i've v 0.6.11 while my friend v 0.6.10.. so i downloaded the latest version v 0.6.17 and it doesn't launch errors anymore while starting the server...

pdeschen commented 12 years ago

Interesting. Glad you had it fixed. Maybe the readme.md should mention that it's aint working on v0.6.11...and/or explicitly remove this version from the engines.node property within the package.json (don't even know if it is possible with the version syntax)?

Wanna issue a pull request to @pkrumins regarding package.json's main property (i.e. video v. build/Release/video.node)?