NodeJs controller install error



  • With two almost assembled nodes (ultrasonic distance+ temperature and humidity+temperature+relay) and an almost assembled ethernet gateway I wanted to start with some kind of controller. For me mysensors is still kind of experimental so a separate controller is best.

    Setting up a new RPi following the instructions on
    https://github.com/mysensors/Arduino/tree/development/NodeJsController
    The instructions are straight forward, until the very last step.
    npm is missing but that can be solved very quickly with
    "sudo apt-get install npm"

    pi@raspberrypi ~/Arduino/NodeJsController $ npm install
    npm http GET https://registry.npmjs.org/mongodb
    npm http GET https://registry.npmjs.org/net
    npm http GET https://registry.npmjs.org/requestify
    npm http GET https://registry.npmjs.org/serialport

    npm ERR! Error: failed to fetch from registry: net
    npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
    npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
    npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
    npm ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
    npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
    npm ERR! at Request.emit (events.js:88:20)
    npm ERR! at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
    npm ERR! at ClientRequest.g (events.js:156:14)
    npm ERR! at ClientRequest.emit (events.js:67:17)
    npm ERR! at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1256:7)
    npm ERR! You may report this log at:
    npm ERR! http://bugs.debian.org/npm
    npm ERR! or use
    npm ERR! reportbug --attach /home/pi/Arduino/NodeJsController/npm-debug.log npm
    npm ERR!
    npm ERR! System Linux 3.12.28+
    npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
    npm ERR! cwd /home/pi/Arduino/NodeJsController
    npm ERR! node -v v0.6.19
    npm ERR! npm -v 1.1.4
    npm ERR! message failed to fetch from registry: net
    npm ERR!
    npm ERR! Additional logging details can be found in:
    npm ERR! /home/pi/Arduino/NodeJsController/npm-debug.log
    npm not ok

    With no experience with npm or mongodb I am kind of stuck...


  • Code Contributor

    @larky
    I'm in a rush and can't look at the details but npm should not be missing. The installation of node the way it's described in the instructions wouold install npm as well. If you followed the instructions to add the path and the "node -v" command shows correct results, the same should be true for npm (I think "npm -v" would be an appropriate check for that). Once you changed /etc/profile to include the path you need to at least logout and re-login to ensure the changes are "active". When you do "sudo apt-get npm" you will get a very outdated version of npm (which is why I fetched node and npm from the nodejs.org homepage directly in the instructions).

    From the error message above:

    npm ERR! node -v v0.6.19
    npm ERR! npm -v 1.1.4

    The instructions are for node 0.10.28 and nodejs modules are version specific in a lot of cases (e.g. only valid from 0.8 onwards). When npm tries to download a module that doesn't exist for the node version you are using that would probably cause an error like this...

    Happy to help you resolve this further over the weekend - maybe the hints above will already help you to fix it 🙂



  • node -v gives me
    v0.10.28
    which node gives me
    /opt/node/bin/node, so far soo good.
    /opt/mongo/bin/mongo starts.
    npm --version
    1.1.4

    I can not see where in the instructions npm is installed?
    (https://github.com/mysensors/Arduino/tree/master/NodeJsController)

    And I still don't get why the error message from "npm install" (still) gives me

    • npm ERR! node -v v0.6.19

  • Code Contributor

    @larky
    The package downloaded in this step:

    wget http://nodejs.org/dist/v0.10.28/node-v0.10.28-linux-arm-pi.tar.gz

    includes not just the "node" executable but the "npm" executable as well. Putting the uncompressed content in the right spot and setting the path appropriately afterwards lets you execute npm without the need for any additional installation step (same as for node). As far as I know the npm version that comes with the download in the installation instructions is v1.4.9.



  • I think a typo in the edit of /etc/profile led me to believe that npm was missing, and installed npm with apt-get, and that is NOT the correct way...
    Now npm install is in progress, and no errors yet.

    connection error - trying to reconnect, I think that is a good error!


  • Code Contributor

    @larky said:

    connection error - trying to reconnect, I think that is a good error!

    Yes!!! Glad it was that easy 🙂



  • Can't the npm install here (in the nodejs controller) and npm used for nodeRED be combined to get the best result for MySensors Controller?

    Now comes the more difficult question but a more interesting one: Has this been done by somebody who's ready to share the artifacts in this open domain?


Log in to reply
 

Suggested Topics

  • 2
  • 75
  • 4
  • 2
  • 48
  • 5

1
Online

11.2k
Users

11.1k
Topics

112.5k
Posts