• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Even a simple node_help.js example does not run.

Scheduled Pinned Locked Moved Unsolved Troubleshooting
13 Posts 2 Posters 2.6k Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    sdetweil
    last edited by Apr 12, 2019, 12:13 PM

    @emrhssla said in Even a simple node_help.js example does not run.:

    Log.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);

    as I posted in the other topic, the node_helper content would be displayed in the terminal window
    where u started MM…

    also

    Log.log will not work in node helper. that is only available in the module.js

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    1 Reply Last reply Reply Quote 0
    • S Offline
      sdetweil
      last edited by sdetweil Apr 12, 2019, 12:33 PM Apr 12, 2019, 12:32 PM

      @emrhssla said in Even a simple node_help.js example does not run.:

      also, you need to install the python-shell component…

      need a package.json file

      {
        "name": "MMM-Testpython",
        "description": "sample",
        "version": "0.0.1",
        "dependencies": {
          "python-shell": "latest"
        }
      }
      

      and then run

      npm install
      

      in the module folder

      the updated node_helper.js is

      var NodeHelper = require("node_helper");
      var {PythonShell} = require('python-shell');
      
      module.exports = NodeHelper.create({
        start: function() {},
        
        socketNotificationReceived: function(notification, payload) {
          console.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);
          
        },
      })
      

      and produces this message in the terminal window, when the UI component is clicked

      MMM-Testpython received a socket notification: TEST - Payload: [object Object]
      

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      E 2 Replies Last reply Apr 12, 2019, 1:18 PM Reply Quote 0
      • E Offline
        emrhssla @sdetweil
        last edited by Apr 12, 2019, 1:18 PM

        @sdetweil 0_1555074987553_d58a7d49-677c-4048-a9e4-709a574bc29a-image.png

        Is it normal for these errors to occur?
        /modules/MMM-Testpython/package.json

        S 1 Reply Last reply Apr 12, 2019, 1:27 PM Reply Quote 0
        • E Offline
          emrhssla @sdetweil
          last edited by Apr 12, 2019, 1:26 PM

          @sdetweil said in Even a simple node_help.js example does not run.:

          console.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);

          var NodeHelper = require("node_helper");
          //var {PythonShell} = require('python-shell');
          
          module.exports = NodeHelper.create({
            start: function() {},
            
            socketNotificationReceived: function(notification, payload) {
              console.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);
            },
          })   
          

          0_1555075600760_f2b5f62a-75bc-48ea-9a97-7c88d676b3d5-image.png
          omg…

          S 1 Reply Last reply Apr 12, 2019, 1:28 PM Reply Quote 0
          • S Offline
            sdetweil @emrhssla
            last edited by Apr 12, 2019, 1:27 PM

            @emrhssla sorry, I had a name of “sample” when I did it. I guess the - is not allowed

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            E 1 Reply Last reply Apr 12, 2019, 1:46 PM Reply Quote 0
            • S Offline
              sdetweil @emrhssla
              last edited by sdetweil Apr 12, 2019, 1:29 PM Apr 12, 2019, 1:28 PM

              @emrhssla that log is only from the module file. Not node_helper

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • E Offline
                emrhssla @sdetweil
                last edited by emrhssla Apr 12, 2019, 1:56 PM Apr 12, 2019, 1:46 PM

                @sdetweil

                {
                  "name": "MMMTestpython",
                  "description": "samples",
                  "version": "0.0.1",
                  "dependencies": {
                    "python-shell": "latest"
                  }
                }
                
                

                Do I have to change it like this and install it again? npm install

                0_1555077390063_231c85f3-9d06-4cd8-a2ec-fa08f4db34ee-image.png

                S 1 Reply Last reply Apr 12, 2019, 2:18 PM Reply Quote 0
                • S Offline
                  sdetweil @emrhssla
                  last edited by Apr 12, 2019, 2:18 PM

                  @emrhssla I don’t understand… mine worked perfectly

                  package.json

                  {
                    "name": "MMM-Testpython",
                    "description": "sample",
                    "keywords": [
                      "   none"
                    ],
                    "version": "0.0.1",
                    "dependencies": {
                      "python-shell": "latest"
                    }
                  }
                  
                  /MagicMirror/modules/MMM-Testpython$ npm install
                  npm WARN MMM-Testpython@0.0.1 No repository field.
                  npm WARN MMM-Testpython@0.0.1 No license field.
                  
                  added 1 package from 1 contributor and audited 1 package in 0.821s
                  found 0 vulnerabilities
                  
                  odroid@odroid:~/MagicMirror/modules/MMM-Testpython$
                  

                  what version of npm do you have

                  npm -v

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  E 2 Replies Last reply Apr 12, 2019, 2:45 PM Reply Quote 0
                  • E Offline
                    emrhssla @sdetweil
                    last edited by Apr 12, 2019, 2:45 PM

                    This post is deleted!
                    S 1 Reply Last reply Apr 12, 2019, 2:47 PM Reply Quote 0
                    • S Offline
                      sdetweil @emrhssla
                      last edited by Apr 12, 2019, 2:47 PM

                      @emrhssla no…

                      mine is uppercase… oh well… anyhow u got it…

                      same npm version

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      1 / 2
                      • First post
                        6/13
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy