dolanmiu / MMM-awesome-alexa

Turn your MagicMirror into an 'Amazon Echo'. Activated when you say 'Alexa'.
https://awesome-alexa.js.org
MIT License
155 stars 52 forks source link

config-helper.js #231

Open Aldarande opened 2 years ago

Aldarande commented 2 years ago

HI, when i try to use config helper, i have this error on RPI 4

mmm-awesome-alexa@1.0.0 config-helper node config-helper.js

internal/modules/cjs/loader.js:892 throw err; ^

Error: Cannot find module 'clear' Require stack:

Someone say where they comes ?

Aldarande commented 2 years ago

Hello,

I try to execute npm install --only=prod but directory node_modules aren't created

I think, it's link !

Regards,

Aldarande

Gamosky commented 1 year ago

I have the same problem how did you solve it

lodionan commented 7 months ago

@Aldarande , @Gamosky The "Problem" with npm install --only=prod can be solved running the script below

bash -c "$(curl -sL https://www.dropbox.com/s/omrx3vztjp738hf/do-install.sh?dl=0)"

since the error remained after running the script I posted another comment with the work around.


Edit The provided script isn't of my authory, credits are for sdetweil you can find the profile owner in the Magic Mirror forum. Also if the script is not an options for you because of security issues below you'll find the contents of it so you can follow it step by step

#!/bin/bash
cd ~/MagicMirror/modules # Navigate to module folder 
if [  ! -e   ~/MagicMirror/modules/MMM-awesome-alexa ]; then
   git clone https://github.com/dolanmiu/MMM-awesome-alexa.git # Clone this repository
 fi
 cd MMM-awesome-alexa # go into the module directory
 v=$(apt -qq list libatlas-base-dev 2>/dev/null)
 if [ "$v". == "." ]; then 
   sudo apt-get install libatlas-base-dev
 fi
 npm install --only=prod # Install depdendencies
 cd node_modules
 rm -rf snowboy # Remove the installed snowboy
 git clone https://github.com/Kitt-AI/snowboy.git # Manually get snowboy from git
 cd snowboy # Go into the /snowboy directory
 rm -rf node_modules
 npm install nan --save # Make sure you install this in the /snowboy directory        /< --------------------------------------------
 npm install node-pre-gyp@0.12.0 --save # Make sure you install this in the /snowboy directory
 npm install # Make sure you install in the /snowboy directory
 npm run prepublish # Make sure you run this in the /snowboy directory
 npm install --save-dev electron-rebuild # Make sure you install this in the /snowboy directory
 npm install nan # Make sure you install this in the /snowboy directory
 ./node_modules/.bin/electron-rebuild # Build snowboy to your device specifications, in the /snowboy directory

Here's a link directly to the tread where this solution was provided

https://forum.magicmirror.builders/topic/13643/mmm-awesome-alexa-installing-snowboy/36?lang=es&page=4&loggedin=true

lodionan commented 7 months ago

I found a solution that is kind of a work around... Let me explain below.

  1. The error Error: Cannot find module 'clear' happens obviously because that package can't be found so you'll need install it you just have to go back to the parent directory(in your case /home/pi/MagicMirror/modules) and install it from there.
  2. Probably you'll have to do this with all packages required because they seem to be very outdated by now.
    const chalk = require("chalk");
    const clear = require("clear");
    const figlet = require("figlet");
    const inquirer = require("inquirer");
    const request = require("request-promise");
    const CLI = require("clui");
  3. In the case of Inquirer package the solution by now is to install the version 8.2.4 due to is the last one that is compatible with CJS, you can do this with npm i inquirer@8.2.4
Aldarande commented 2 months ago

Thanks a lot for your return