Read the statement by Michael Teeuw here.
NPM install is giving Error.
-
@postremalone said in NPM install is giving Error.:
NPM install is giving error.
Help please.
I meet the same issue than you and I solved it by uninstalling nodejs
sudo apt-get remove nodejs
and reinstall nodejs by using the MagicMirror install script
bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)"
During the installation, npm install -g npm@latest give me this error
npm ERR! path /usr/lib/node_modules/npm/node_modules/ansi-regex npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules/npm/node_modules/ansi-regex' npm ERR! { Error: EACCES: permission denied, access '/usr/lib/node_modules/npm/node_modules/ansi-regex' npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules/npm/node_modules/ansi-regex\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/lib/node_modules/npm/node_modules/ansi-regex' } npm ERR! npm ERR! Please try running this command again as root/Administrator.
and I run same command as root to solved this
sudo npm install -g npm@latest
Here is version of nodejs install by MagicMirror script :
Installed Node version: v9.11.2
-
pi@raspberrypi:~/MagicMirror $ npm start > magicmirror@2.4.1 start /home/pi/MagicMirror > sh run-start.sh /home/pi/MagicMirror/node_modules/electron/index.js:1 (function (exports, require, module, __filename, __dirname) { SyntaxError: Invalid or unexpected token at new Script (vm.js:51:7) at createScript (vm.js:136:10) at Object.runInThisContext (vm.js:197:10) at Module._compile (internal/modules/cjs/loader.js:618:28) at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10) at Module.load (internal/modules/cjs/loader.js:566:32) at tryModuleLoad (internal/modules/cjs/loader.js:506:12) at Function.Module._load (internal/modules/cjs/loader.js:498:3) at Module.require (internal/modules/cjs/loader.js:598:17) at require (internal/modules/cjs/helpers.js:11:18) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! magicmirror@2.4.1 start: `sh run-start.sh` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the magicmirror@2.4.1 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/pi/.npm/_logs/2018-09-13T10_40_56_673Z-debug.log
-
@nonamero I’ve brought this up on another thread, but I’ll mention here so that it is captured in context: for the last couple months Node.js and npm are currently BROKEN on RaspberryPi.
I just tried a test this morning using the started Electron app at https://electronjs.org/docs/tutorial/first-app
Running the automated install is a Red Herring. It is inappropriate to suggest it.
We have to figure out how to fix the bugs in the Node.js installation for Raspberry Pi before anything else. I’m wondering if installing an older version of Node.js is the solution. If so, then what version would we start with?
-
I just installed a module and it asked me to update NPM think i did it in the root directory not MagicMirror one can be sure.
This is what worked for me
sudo npm i -g npm -
Aha-got it!
sudo rm -rf ~/.nvm sudo rm /usr/local/bin/node sudo rm /usr/local/bin/nvm pm2 stop mm (not sure if I missed this earlier) bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)"
This installed fine, but gave me an error of an out-of-date npm version, so I ran:
sudo npm i -g npm
Then moved all my old modules and config file over to the new install and checked my node/npm versions:
pi@raspberrypi:~/MagicMirrorBackup/modules $ node -v v9.11.2 pi@raspberrypi:~/MagicMirrorBackup/modules $ npm -v 6.5.0
So they’re not as up-to-date as my previous ones, but MagicMirror is working fine!
Thanks everyone for the input, turns out just a bit of manual removal and persistence sorted me out!