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 3.8k 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 sdetweil

      @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 Reply Quote 0
      • E Offline
        emrhssla @sdetweil
        last edited by

        @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 Reply Quote 0
        • E Offline
          emrhssla @sdetweil
          last edited by

          @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 Reply Quote 0
          • S Offline
            sdetweil @emrhssla
            last edited by

            @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 Reply Quote 0
            • S Offline
              sdetweil @emrhssla
              last edited by sdetweil

              @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

                @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 Reply Quote 0
                • S Offline
                  sdetweil @emrhssla
                  last edited by

                  @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 Reply Quote 0
                  • E Offline
                    emrhssla @sdetweil
                    last edited by

                    This post is deleted!
                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @emrhssla
                      last edited by

                      @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
                      • E Offline
                        emrhssla @sdetweil
                        last edited by

                        @sdetweil

                        0_1555081065957_ef2bd581-f7e5-44c1-afc3-6df8fea70a50-image.png

                        omg…

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          sdetweil
                          last edited by sdetweil

                          Looks like your system doesn’t have python installed.

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          1 Reply Last reply Reply Quote 0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          • 1 / 1
                          • First post
                            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