ni-c / heimcontrol.js

Home-Automation with node.js and Raspberry PI
MIT License
1.41k stars 297 forks source link

cannot npm install heimcontrol.js #104

Open TexRx opened 9 years ago

TexRx commented 9 years ago

Has anyone actually built this lately? I've followed the instructions, and I've tried multiple times, and each time I get an error running npm install. I am using Node 0.10.32 / npm 1.4.28. I've run npm install w/ and w/o sudo.

The first warning message I receive after running npm install is

npm WARN excluding symbolic link src/du.ino -> duino/duino.ino

Then I receive

> serialport@1.4.6 install /home/tobino/heimcontrol.js/node_modules/duino/node_modules/serialport
> node-pre-gyp install --fallback-to-build

Then I receive a really long error message related to node-gyp (sorry for the long paste):

gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: node-v0.10.32.tar.gz local checksum 7774bc5b9e61b040f653ee5a6b58c7cf4c065729501655deb0d35ec941c0eb46 not match remote c2120d0e3d2d191654cb11dbc0a33a7216d537
32173317681da9502be0030f10
gyp ERR! stack     at deref (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:299:20)
gyp ERR! stack     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:340:13)
gyp ERR! stack     at IncomingMessage.emit (events.js:117:20)
gyp ERR! stack     at _stream_readable.js:943:16
gyp ERR! stack     at process._tickCallback (node.js:419:13)
gyp ERR! System Linux 3.12.29+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--name=serialport" "--configuration=Release" "--module_n
ame=serialport" "--version=1.4.6" "--major=1" "--minor=4" "--patch=6" "--runtime=node" "--node_abi=node-v11" "--platform=linux" "--target_platform=linux" "--arch=arm" "--target_a
rch=arm" "--module_main=./serialport" "--host=https://node-serialport.s3.amazonaws.com/" "--module_path=/home/tobino/heimcontrol.js/node_modules/duino/node_modules/serialport/bui
ld/serialport/v1.4.6/Release/node-v11-linux-arm" "--remote_path=./serialport/v1.4.6/Release/" "--package_name=node-v11-linux-arm.tar.gz" "--staged_tarball=build/stage/serialport/
v1.4.6/Release/node-v11-linux-arm.tar.gz" "--hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v1.4.6/Release/" "--hosted_tarball=https://node-serialport.s3.amazona
ws.com/serialport/v1.4.6/Release/node-v11-linux-arm.tar.gz"
gyp ERR! cwd /home/tobino/heimcontrol.js/node_modules/duino/node_modules/serialport
gyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node rebuild --name=serialport --configuration=Release --module_name=serialport --version=1.4.6 --major=1 --mino$=4 --patch=6 --runtime=node --node_abi=node-v11 --platform=linux --target_platform=linux --arch=arm --target_arch=arm --module_main=./serialport --host=https://node-serialport.s$.amazonaws.com/ --module_path=/home/tobino/heimcontrol.js/node_modules/duino/node_modules/serialport/build/serialport/v1.4.6/Release/node-v11-linux-arm --remote_path=./serialpor$/v1.4.6/Release/ --package_name=node-v11-linux-arm.tar.gz --staged_tarball=build/stage/serialport/v1.4.6/Release/node-v11-linux-arm.tar.gz --hosted_path=https://node-serialport.$3.amazonaws.com/serialport/v1.4.6/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v1.4.6/Release/node-v11-linux-arm.tar.gz' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/tobino/heimcontrol.js/node_modules/duino/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:76:$9)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:756:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:823:5)
node-pre-gyp ERR! System Linux 3.12.29+
node-pre-gyp ERR! command "node" "/home/tobino/heimcontrol.js/node_modules/duino/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/tobino/heimcontrol.js/node_modules/duino/node_modules/serialport
node-pre-gyp ERR! node -v v0.10.32
node-pre-gyp ERR! node-pre-gyp -v v0.5.19
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node rebuild --name=serialport --configuration=Release --module_name=serialport --version=1.4.6 --major=1 --minor=4 --patch=6 --runtime=node --n
ode_abi=node-v11 --platform=linux --target_platform=linux --arch=arm --target_arch=arm --module_main=./serialport --host=https://node-serialport.s3.amazonaws.com/ --module_path=/
home/tobino/heimcontrol.js/node_modules/duino/node_modules/serialport/build/serialport/v1.4.6/Release/node-v11-linux-arm --remote_path=./serialport/v1.4.6/Release/ --package_name
=node-v11-linux-arm.tar.gz --staged_tarball=build/stage/serialport/v1.4.6/Release/node-v11-linux-arm.tar.gz --hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v1.4
.6/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v1.4.6/Release/node-v11-linux-arm.tar.gz' (1)

npm ERR! serialport@1.4.6 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport@1.4.6 install script.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR!     npm owner ls serialport
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.12.29+
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /home/tobino/heimcontrol.js
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

I've looked up the relevant dependency repos and I don't see any reported issues relevant to the issues that I see during install. Any ideas?

TexRx commented 9 years ago

Actually - sorry I was wrong - I found this issue on the serialport repo issue list: https://github.com/voodootikigod/node-serialport/issues/368

tjanson commented 9 years ago

Let us know how it turns out. Serialport@1.4.6 installs fine for me (npm v2.1.4). Maybe it only happens with a certain version combo.

TexRx commented 9 years ago

What version of node do you have installed on your rpi? I have 0.10.32? Or did you update npm itself without updating node?

TexRx commented 9 years ago

I was able to get around this issue by:

1) removing node / npm 2) using sudo apt-get install npm 3) git clone [nvm repo] 4) setup bashrc and profile with nvm commands 5) reboot 6) nvm install node 0.10.28

Once I did this, I was able to run npm install in the heimcontroljs dir without any issues.

HOWEVER when I run node heimcontrol.js, I get an error thrown from r.js:

Unexpected token ')'

When I look in the requires package (bin/r.js), the r.js file appears to be truncated at the end. Any ideas?

TexRx commented 9 years ago

UPDATE:

I finally got all of this working by:

1) npm cache clean --force 2) npm update 3) chown $USER .bin in the node_modules folder,

I hope this helps someone else.

tjanson commented 9 years ago

Sorry you had all this trouble. For the record, my versions are:

$ npm -v
2.1.4

$ node-gyp --version
v1.0.2

$ node -v
v0.10.32

$ uname -a
Linux alarmpi 3.16.3-1-ARCH #1 PREEMPT Mon Sep 22 03:53:26 MDT 2014 armv6l GNU/Linux

(So there shouldn't be any need to downgrade.)

TexRx commented 9 years ago

Do you mind me asking - you're not running Debian Wheezy right? You loaded your SD card w/ 3.6.13 downloaded from http://archlinuxarm.org/platforms/armv6/raspberry-pi or similar? I suppose that's not related, but I am running Debian Wheezy and my alarmpi version is 3.12.1+

tjanson commented 9 years ago

Yes, I use Archlinux whenever possible. Can't get used to Debian's year-old packages.

I did just try installing/building Heimcontrol on my Debian Pi, and it worked without issues.

Maybe the crucial point is the Node version, I believe mine was compiled from source a month ago or something. Where did you get yours?

TexRx commented 9 years ago

OK - I cannot get this to run. Here are my environment specs:

$ node -v
v0.10.32

$ npm -v
2.1.5

$ node-gyp --version
v1.0.2

$ uname -a
Linux alarmpi 3.12.28-2-ARCH #1 PREEMPT Mon Sep 22 02:02:11 MDT 2014 armv6l GNU/Linux

I first resurfaced my SD with the arch linux OS version that is available via the RPi noobs installer. That version is shown above. I then setup the linux environment (e.g., locales, swapfiles, users, etc) and installed all packages (via pacman) that I thought I would need (e.g., all the standard packages + git, node, mongo, gcc, make, etc). \ I did not install node from source -- I installed node from pacman **:

$ pacman -S nodejs

Then I:

$ cd ~

$ git clone https://github.com/ni-c/heimcontrol.js.git

$ cd heimcontrol.js

[heimcontrol.js]$ npm install

This is what happens when I run npm install

npm WARN package.json jade@0.35.0 No README data
npm WARN excluding symbolic link src/du.ino -> duino/duino.ino
npm WARN excluding symbolic link src/du.ino -> duino/duino.ino
\
> serialport@1.4.6 install /home/tobino/heimcontrol.js/node_modules/duino/node_modules/serialport
> node-pre-gyp install --fallback-to-build

make: Entering directory '/home/tobino/heimcontrol.js/node_modules/duino/node_modules/serialport/build'
  CXX(target) Release/obj.target/serialport/src/serialport.o
  CXX(target) Release/obj.target/serialport/src/serialport_unix.o
  CXX(target) Release/obj.target/serialport/src/serialport_poller.o
  SOLINK_MODULE(target) Release/obj.target/serialport.node
  SOLINK_MODULE(target) Release/obj.target/serialport.node: Finished
  COPY Release/serialport.node
  COPY /home/tobino/heimcontrol.js/node_modules/duino/node_modules/serialport/build/serialport/v1.4.6/Release/node-v11-linux-arm/serialport.node
  TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/home/tobino/heimcontrol.js/node_modules/duino/node_modules/serialport/build'
duino@0.1.0 node_modules/duino
├── chalk@0.5.1 (escape-string-regexp@1.0.2, ansi-styles@1.1.0, supports-color@0.2.0, has-ansi@0.1.0, strip-ansi@0.3.0)
└── serialport@1.4.6 (bindings@1.2.1, sf@0.1.7, async@0.9.0, nan@1.3.0, optimist@0.6.1)
[tobino@alarmpi heimcontrol.js]$ node heimcontrol.js

/home/tobino/heimcontrol.js/node_modules/requirejs/bin/r.js:11069
/***********************************************************************
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    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 Object.<anonymous> (/home/tobino/heimcontrol.js/heimcontrol.js:13:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

I have no idea what causes that, but you or anyone else do not seem to have this problem, despite seemingly having the same environment.

So I then run npm update. This, of course, updates a bunch of modules, builds a bunch of stuff and then completes without any errors.

Afterwards, I run node heimcontroljs, and I see this:

[heimcontrol.js]$ node heimcontroljs

WARNING: Change secret string in config/development.json
   info  - socket.io started
connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0
heimcontrol.js listening on port 8080

/home/tobino/heimcontrol.js/node_modules/requirejs/bin/r.js:378
        throw err;
              ^
Error: Tried loading "piswitch" at /home/tobino/heimcontrol.js/piswitch.js then tried node's require("piswitch") and it failed with error: Error: Cannot find module '../build/Release/wiringPi'
    at /home/tobino/heimcontrol.js/node_modules/requirejs/bin/r.js:2512:27
    at Object.context.execCb (/home/tobino/heimcontrol.js/node_modules/requirejs/bin/r.js:1876:33)
    at Object.Module.check (/home/tobino/heimcontrol.js/node_modules/requirejs/bin/r.js:1110:51)
    at Object.Module.enable (/home/tobino/heimcontrol.js/node_modules/requirejs/bin/r.js:1381:22)
    at Object.Module.init (/home/tobino/heimcontrol.js/node_modules/requirejs/bin/r.js:1018:26)
    at callGetModule (/home/tobino/heimcontrol.js/node_modules/requirejs/bin/r.js:1408:63)
    at Object.context.completeLoad (/home/tobino/heimcontrol.js/node_modules/requirejs/bin/r.js:1770:21)
    at Function.req.load (/home/tobino/heimcontrol.js/node_modules/requirejs/bin/r.js:2525:17)
    at Object.context.load (/home/tobino/heimcontrol.js/node_modules/requirejs/bin/r.js:1865:21)
    at Object.Module.load (/home/tobino/heimcontrol.js/node_modules/requirejs/bin/r.js:1064:29)

This is where I am at now. I've done everything I can think of, and I cannot understand how you or anyone else can clone the repo, run npm install and then node heimcontroljs, and not see the errors I am seeing.

Any ideas? I know this is not your responsibility, and I am not complaining. I am just trying to get this up and running so I can use it. I will turn to johnny-five if I can't get this working very soon, but I would prefer to use this.

Thanks in advance,

tjanson commented 9 years ago

Does node_modules/piswitch/node_modules/wiring-pi/build/Release/wiringPi.node exist?

If you want, you could send me an archive of the HC folder and I’ll try to reproduce it locally.

TexRx commented 9 years ago

\ UPDATE **

Yes, that file at that path exists. I now have this running and I am able to browse to the site and configure the settings. To get this running, in addition to everything I've described above, I had to:

[heimcontrol.js $] cd node_modules/piswitch/node_modules/wiring-pi

[wiring-pi $] sudo ./install.sh

[wiring-pi $] cd ~

Then I ran node heimcontroljs and received an error from r.js that it could not find the mime module, so I then ran:

$ npm install mime

After these 2 steps, I was able to run node heimcontroljs, and I did not receive any errors and the app started and I could load the app landing page in a browser.

Thanks for all of your attention and assistance.

kristianenge commented 9 years ago

Hi, I have tried to install heimcontrol.js multiple times on Raspbian but I can`t get passed the 'npm install' step.

Error:

make: Entering directory '/home/pi/heimcontrol.js/node_modules/piswitch/node_modules/wiring-pi/build'
  CXX(target) Release/obj.target/wiringPi/src/bindings.o
../src/bindings.cc: In function ‘v8::Handle<v8::Value> wpi::piBoardId(const v8::Arguments&)’:
../src/bindings.cc:660:44: error: cannot convert ‘char**’ to ‘int*’ for argument ‘4’ to ‘void piBoardId(int*, int*, int*, int*, int*)’
wiringPi.target.mk:84: recipe for target 'Release/obj.target/wiringPi/src/bindings.o' failed
make: *** [Release/obj.target/wiringPi/src/bindings.o] Error 1
make: Leaving directory '/home/pi/heimcontrol.js/node_modules/piswitch/node_modules/wiring-pi/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:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:807:12)
gyp ERR! System Linux 3.12.35+
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/heimcontrol.js/node_modules/piswitch/node_modules/wiring-pi
gyp ERR! node -v v0.10.28
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
npm ERR! wiring-pi@1.1.2 install: `/bin/bash ./install.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wiring-pi@1.1.2 install script.
npm ERR! This is most likely a problem with the wiring-pi package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     /bin/bash ./install.sh
npm ERR! You can get their info via:
npm ERR!     npm owner ls wiring-pi
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.12.35+
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /home/pi/heimcontrol.js
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/heimcontrol.js/npm-debug.log
npm ERR! not ok code 0

Should I try installing on ArchLinux instead?

tjanson commented 9 years ago

@kristianenge I think this issue is not related to Raspbian/Arch/npm; wiring-pi is not compiling, which is a dependency of my PiSwitch plugin. (So this is really a completely separate issue.)

One workaround would be to delete the folder plugins/piswitch and the line "piswitch": "^1.0.3" — assuming you don’t need the 433 MHz remote functionality.

Other options are trying to fix the error in the source, or switching to wiring-pi v2. I’ll try to look into this when I have some time. You could also file an issue with wiring-pi and have them take a look.

kristianenge commented 9 years ago

@tjanson Thank you for the fast response. The workaround got me passed the error as you predicted.

I will file an issue with wiring-pi .

I cannot find the wiring-pi v2 repo, but maybe it isn`t released yet?

tjanson commented 9 years ago

I cannot find the wiring-pi v2 repo, but maybe it isn`t released yet?

It’s not a separate repo, it’s just the regular one [npm]– v2 was published a few days ago. You can test whether it works for you by trying npm install wiring-pi. If it works and it’s compatible (I’d need to look into this), I could update the dependency.

jam206 commented 9 years ago

Spent many hours yesterday on this and encountered the exact same issue, won't post any error messages as they are pretty much the same as already posted, in the end I managed to install v2 manually and then forced v2 into the heimcontrol.js directory and managed to get it past the install process without errors, but fell over at run time piswitch started looking for 1.1.2 again. Is there a way we can alter the dependency locally so it looks for 2.0 instead of 1.1.2 for now? I know it's possible to have further compatibility issues doing this without investigating the new package more thoroughly, but a big part of what I'm trying to do revolves around 433mhz controllers.

beniroquai commented 9 years ago

Same Issue here. Is there any update about this issue so far?

tjanson commented 9 years ago

Can you try the following for me: Increase the version number in line 28 of package.json to this:

    "piswitch": "^1.2.3"

Then npm install. This will use wiring-pi v2.0.0 — I haven’t tested it, but it might work. Sorry for not supporting this better, I don’t have much time at the moment. If it still fails, remove PiSwitch from heimcontrol, like I said here:

One workaround would be to delete the folder plugins/piswitch and the line "piswitch": "^1.0.3" — assuming you don’t need the 433 MHz remote functionality.

beniroquai commented 9 years ago

Actually it didn't help. I installed mongopi and node via the precompiled repositories. Could that be an issue?

ewgor commented 9 years ago

Did anyone tried this application using nodejs installed on a laptop running windows 7? I'm asking because I tried and I got a lot of errors I don't understand.