Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config-helper.js #231

Open
Aldarande opened this issue Oct 3, 2021 · 5 comments
Open

config-helper.js #231

Aldarande opened this issue Oct 3, 2021 · 5 comments

Comments

@Aldarande
Copy link

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:

  • /home/pi/MagicMirror/modules/MMM-awesome-alexa/config-helper.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object. (/home/pi/MagicMirror/modules/MMM-awesome-alexa/config-helper.js:2:15)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [ '/home/pi/MagicMirror/modules/MMM-awesome-alexa/config-helper.js' ]
    }

Someone say where they comes ?

@Aldarande
Copy link
Author

Hello,

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

I think, it's link !

Regards,

Aldarande

@Gamosky
Copy link

Gamosky commented Mar 28, 2023

I have the same problem how did you solve it

@lodionan
Copy link

lodionan commented Dec 14, 2023

@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
Copy link

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");
  1. 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
Copy link
Author

Thanks a lot for your return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants