victordibia / tjwave

Fun javascipt app to control the IBM TJBot Robot Arm (servo motor)
8 stars 20 forks source link

nmp install failing #1

Open stevenlouis opened 7 years ago

stevenlouis commented 7 years ago

Upon attempting npm install, getting several errors. (Wavetest.js attempted after and will not run.)

errors as follows:

/tjwave-master $ npm install

> speaker@0.3.0 install /home/pi/tjwave-master/node_modules/speaker
> node-gyp rebuild

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
make: Entering directory '/home/pi/tjwave-master/node_modules/speaker/build'
  CC(target) Release/obj.target/output/deps/mpg123/src/output/alsa.o
../deps/mpg123/src/output/alsa.c:19:28: fatal error: alsa/asoundlib.h: No such file or directory
 #include <alsa/asoundlib.h>
                            ^
compilation terminated.
deps/mpg123/output.target.mk:107: recipe for target 'Release/obj.target/output/deps/mpg123/src/output/alsa.o' failed
make: *** [Release/obj.target/output/deps/mpg123/src/output/alsa.o] Error 1
make: Leaving directory '/home/pi/tjwave-master/node_modules/speaker/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/pi/.nvm/versions/node/v7.2.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.34-v7+
gyp ERR! command "/home/pi/.nvm/versions/node/v7.2.1/bin/node" "/home/pi/.nvm/versions/node/v7.2.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/tjwave-master/node_modules/speaker
gyp ERR! node -v v7.2.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm WARN tjwave@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: speaker@0.3.0 (node_modules/speaker):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: speaker@0.3.0 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
victordibia commented 7 years ago

Thanks for sharing this. A couple of quick questions .. do you have alsa (sound) libraries installed ?

sudo apt-get install alsa-base alsa-utils sudo apt-get install libasound2-dev

Your error appears similar to the error here - https://github.com/TooTallNate/node-speaker/issues/1

Let me know if this installing the sound libs fix it for you.

-V.

stevenlouis commented 7 years ago

The first command was run, but I did not see the second. Just ran it followed by npm install again and it seems to have gotten rid of the npm install errors. However, the wavetest.js run is still returning errors. Running without sudo returns permission errors and running with sudo returns the following:

/tjwave-master $ sudo node wavetest.js 

module.js:356
  Module._extensions[extension](this, filename);
                               ^
Error: /home/pi/tjwave-master/node_modules/rpi-ws281x-native/lib/binding/rpi_ws281x.node: undefined symbol: node_module_register
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at getNativeBindings (/home/pi/tjwave-master/node_modules/rpi-ws281x-native/lib/ws281x-native.js:60:12)
    at Object.<anonymous> (/home/pi/tjwave-master/node_modules/rpi-ws281x-native/lib/ws281x-native.js:63:16)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
stevenlouis commented 7 years ago

Errors when running wavetest.js without sudo:

/tjwave-master $ node wavetest.js 
[rpi-ws281x-native] This module requires being run with root-privileges. A non-functional stub of the interface will be returned.
2016-12-20 12:36:55 initCheckPermitted: 
+---------------------------------------------------------+
|Sorry, you don't have permission to run this program.    |
|Try running as root, e.g. precede the command with sudo. |
+---------------------------------------------------------+

/home/pi/tjwave-master/node_modules/pigpio/pigpio.js:11
    pigpio.gpioInitialise();
           ^

Error: pigpio error -1 in gpioInitialise
    at initializePigpio (/home/pi/tjwave-master/node_modules/pigpio/pigpio.js:11:12)
    at new Gpio (/home/pi/tjwave-master/node_modules/pigpio/pigpio.js:25:3)
    at Object.<anonymous> (/home/pi/tjwave-master/wavetest.js:19:13)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:420:7)
victordibia commented 7 years ago

I just updated readme with the second libasound2-dev line, thats why you didnt see that earlier (my fault). Regarding the module error above, can you try deleting your node_modules folder and installing again. I suspect the earlier errors may have corrupted your node_modules install folder.

rm -rf node_modules
npm install

Yeah, you do need root (sudo) to control your servo motor and leds.

-V.

stevenlouis commented 7 years ago

removed the node_modules directory and ran the install again, but we're still getting errors.

tjwave-master $ node wavetest.js 
[rpi-ws281x-native] This module requires being run with root-privileges. A non-functional stub of the interface will be returned.
2016-12-20 12:40:49 initCheckPermitted: 
+---------------------------------------------------------+
|Sorry, you don't have permission to run this program.    |
|Try running as root, e.g. precede the command with sudo. |
+---------------------------------------------------------+

/home/pi/tjwave-master/node_modules/pigpio/pigpio.js:11
    pigpio.gpioInitialise();
           ^

Error: pigpio error -1 in gpioInitialise
    at initializePigpio (/home/pi/tjwave-master/node_modules/pigpio/pigpio.js:11:12)
    at new Gpio (/home/pi/tjwave-master/node_modules/pigpio/pigpio.js:25:3)
    at Object.<anonymous> (/home/pi/tjwave-master/wavetest.js:19:13)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:420:7)

/tjwave-master $ sudo node wavetest.js 

module.js:356
  Module._extensions[extension](this, filename);
                               ^
Error: /home/pi/tjwave-master/node_modules/rpi-ws281x-native/lib/binding/rpi_ws281x.node: undefined symbol: node_module_register
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at getNativeBindings (/home/pi/tjwave-master/node_modules/rpi-ws281x-native/lib/ws281x-native.js:60:12)
    at Object.<anonymous> (/home/pi/tjwave-master/node_modules/rpi-ws281x-native/lib/ws281x-native.js:63:16)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
victordibia commented 7 years ago

There is a possibility that you have an old version of node being referenced. Can you provide the results to the following commands

which node and node -v

to make sure

It appears a similar issue has been noted here - Unitech/pm2#1477

stevenlouis commented 7 years ago

which node: /home/pi/.nvm/versions/node/v7.2.1/bin/node

node -v: v7.2.1

victordibia commented 7 years ago

I see you use nvm to manage node versions. I also see it appears to be correctly installed (the earlier error suggests npm was correctly referencing your v7.2.1 installation).

Some thoughts though.

Going by the comment here

For us, it was because we installed node 0.10.x a long time ago globally /usr/local/bin and then setup NVM after. While our app was using the NVM version 0.12.x npm install was actually using the globally installed version in /usr/local/bin.

The solution, was to delete all references to node in /usr/loca/bin and only use NVM. Then do npm install again.

Perhaps you can delete the node directory in /usr/local/bin if you haven't done so already, delete node_modules folder, and npm install .

-V.

stevenlouis commented 7 years ago

I'm not seeing anything related to node in that directory. Could it be somewhere else?

pi@raspberrypi:/usr/local/bin $ ls
ffmpeg  ffprobe  ffserver  x264
victordibia commented 7 years ago

Unlikely. Finally, any chance you can reinstall node without nvm ?

-V