Read the statement by Michael Teeuw here.
Error on starting MM2: module not present
-
@mwel1977 npm is the Node Package Manager. It makes sure all the env is right (read package.json), then launches node to execute the startup script.
You can code different actions, and then tell npm to execute that action.
foobar: some command
Then npm foobar will execute that command
-
@sdetweil is npm then the compiler?
If so how can I recompile the mmm-usonic module so it works with my current Node.js version?
Is there somewere documentation on how this npm works and how all the modules are tide in it? -
npm --help should give you the options…
from MM,
npm rebuild MMM-usonic
-
@sdetweil And do I have to be in a specific folder for this command (in the npm home folder or the mmm-usonic for instance)?
Or can I just type it in the terminal from the start (/Home/Pi/)?
That is what I still don’t quite get. What command must be used in what (folder) location.
But I’ll try that command tonight at home.
(I have my 3B+ with me here at work (that has the “working” MM2 on it. At home I have the Pi 3A+ attached to the 7" touchscreen and has the “test enviroment” of my MM2 on it. So when something works on the 3A+ (and I know how to do it right) I can do it first time right on the 3B+.:smiling_face_with_open_mouth_smiling_eyes: ) -
@mwel1977 well, you can be in many different places…
npm install (no other parms) will install the module in the current folder, so this could be MagicMirror (for all using modules), OR it could be in the MMM-Swipe folder only (then only available for MMM-Swipe)
or you can add -g parm, and regardless of the current folder, it is added to the system wide node_modules, so it is available for any/all applications that want/need to use it.
-
@sdetweil may I ask you were you think that mmm-usonic module should be install in order for it to work with the mmm-swipe module?
Reading what your telling me I’m starting to think it should be installed in the MMM-Swipe folder. However the error notification shows that it found the mmm-usonic module only it’s compiled with a wrong version.I’ll try you suggestion “npm rebuild MMM-usonic” tonight and from the folder “/Home/Pi/” and see what happens (If I understand you correctly I can also use just “npm rebuild” when I’m in the folder “/Home/Pi/node_modules/mmm-usonic/”).
And I think I’ll start reading this after I’ve done that: https://docs.npmjs.com/ :grinning_face_with_smiling_eyes:
Hope I’ll know more about npm afterwards. -
where was it installed (check the MM/node-modules folder and the MM/modules/MMM-Swipe/node-modules folder…
rebuild where found…
-
@sdetweil
Oh…crap! :flushed_face: I have a node_modules folder under Home/Pi
not under Home/Pi/MagicMirror.
Think I’ll format my micro SD card and start over. This time when I install something for the MM I’ll do it from the directory Home/Pi/MagicMirror.
Don’t think I can just “move” the content of the Home/Pi/node_modules to the MagicMirror folder can I? :weary_face: -
@mwel1977 just erase the one in /home/pi (rm -rf node_modules) and then start from the MM folder,
then erase node_modules, then do npm install, then switch to MMM-Swipe and do npm install,
then npm rebuild MMM-usonicno need to wipe and start over…
-
@sdetweil If I understand you right:
#1 remove node_modules in “Home/Pi” and in “Home/Pi/MagicMirror” with command “rm -rf node_modules”
#2 re-install npm in the folder “Home/Pi/MagicMirror” and in “Home/Pi/MagicMirror/MMM-Swipe”
#3 then re-install the module mmm-usonic in the folder “Home/Pi/MagicMirror/MMM-Swipe”
#4 then rebuild the usonic module with “npm rebuild mmm-usonic”I have doubt on where to install step 3. Should it go in the folder from the MagicMirror or from de module MMM-Swipe? Because I delete the module mmm-usonic with step 1. And I don’t know if this will be installed on re-installing the module MMM-Swipe.
But I’ll check that first thing tonight (if there is a module mmm-usonic being installed with MMM-Swipe). I think it should be installed with it as a dependency from MMM-Swipe.