• 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.

fs.stat SyntaxError: Unexpected token

Scheduled Pinned Locked Moved Troubleshooting
6 Posts 3 Posters 2.8k Views 3 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.
  • N Offline
    ninjabreadman @pepebc
    last edited by Feb 7, 2018, 3:02 AM

    @pepebc It may depend on what precedes that snippet (if anything). Try copy/pasting the whole file into JSHint, it may give you a better idea. Also, doesn’t fs.stat() take a path as the first argument?

    Problem with config or JavaScript? Copy/paste it into JSHint.
    Check out the detailed walkthroughs on install, config, modules, etc.

    1 Reply Last reply Reply Quote 1
    • S Offline
      strawberry 3.141 Project Sponsor Module Developer
      last edited by Feb 7, 2018, 6:12 AM

      Also did you import the fs module correctly?

      Please create a github issue if you need help, so I can keep track

      1 Reply Last reply Reply Quote 0
      • P Offline
        pepebc
        last edited by Feb 7, 2018, 3:20 PM

        fs is included by default in nmp.
        I do tests because I need to verify that a text file exists in the module directory when an attempt was made to create.
        I am not an expert in programming and I am trying with the functions that I find online. Always it gives me that error, although in the forums seems to work. In this environment, it gives me problems.

        N 1 Reply Last reply Feb 7, 2018, 4:17 PM Reply Quote 0
        • N Offline
          ninjabreadman @pepebc
          last edited by Feb 7, 2018, 4:17 PM

          It may be included by default in Node.js, but you still need to import it into your script.

          Problem with config or JavaScript? Copy/paste it into JSHint.
          Check out the detailed walkthroughs on install, config, modules, etc.

          1 Reply Last reply Reply Quote 0
          • P Offline
            pepebc
            last edited by pepebc Feb 7, 2018, 5:47 PM Feb 7, 2018, 5:46 PM

            Yes, I had imported it with const fs = require ('fs');
            but I was not creating the function well in the right place. Thank you.
            It’s crazy what I want, I know. I want to connect Kalliope (modular always-on voice controlled personal assistant) - https://kalliope-project.github.io with MagicMirror. I find it a very powerful and flexible tool. The program I already manage it well separately and I have created “neurons” and “events” … etc, but it would be wonderful to interact with MagicMirror modules.
            Lights, sensors, temperature, webcam, notifications, reading email, music … etc, that I already have it integrated in Kalliope

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 / 1
            • First post
              6/6
              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