pi@archivesw:~ $ sudo npm install pm2 -g
/usr/bin/pm2 -> /usr/lib/node_modules/pm2/bin/pm2
/usr/bin/pm2-dev -> /usr/lib/node_modules/pm2/bin/pm2-dev
/usr/bin/pm2-docker -> /usr/lib/node_modules/pm2/bin/pm2-docker
/usr/bin/pm2-runtime -> /usr/lib/node_modules/pm2/bin/pm2-runtime
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/pm2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
+ pm2@3.3.1
added 311 packages from 268 contributors in 86.074s
pi@archivesw:~ $ npm install -s -q --unsafe-perm
npm WARN saveError ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN pi No description
npm WARN pi No repository field.
npm WARN pi No README data
npm WARN pi No license field.
up to date in 1.092s
found 0 vulnerabilities
pi@archivesw:~ $ sudo n stable
install : node-v11.10.0
mkdir : /usr/local/n/versions/node/11.10.0
fetch : https://nodejs.org/dist/v11.10.0/node-v11.10.0-linux-armv7l.tar.gz
######################################################################## 100.0%
installed : v11.10.0
pi@archivesw:~ $ pm2 list
-------------
__/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____
_\/\\\/////////\\\_\/\\\\\\________/\\\\\\__/\\\///////\\\___
_\/\\\_______\/\\\_\/\\\//\\\____/\\\//\\\_\///______\//\\\__
_\/\\\\\\\\\\\\\/__\/\\\\///\\\/\\\/_\/\\\___________/\\\/___
_\/\\\/////////____\/\\\__\///\\\/___\/\\\________/\\\//_____
_\/\\\_____________\/\\\____\///_____\/\\\_____/\\\//________
_\/\\\_____________\/\\\_____________\/\\\___/\\\/___________
_\/\\\_____________\/\\\_____________\/\\\__/\\\\\\\\\\\\\\\_
_\///______________\///______________\///__\///////////////__
Runtime Edition
PM2 is a Production Process Manager for Node.js applications
with a built-in Load Balancer.
Start and Daemonize any application:
$ pm2 start app.js
Load Balance 4 instances of api.js:
$ pm2 start api.js -i 4
Monitor in production:
$ pm2 monitor
Make pm2 auto-boot at server restart:
$ pm2 startup
To go further checkout:
http://pm2.io/
-------------
[PM2] Spawning PM2 daemon with pm2_home=/home/pi/.pm2
[PM2] PM2 Successfully daemonized
ββββββββ¬βββββ¬βββββββ¬βββββββββ¬ββββ¬ββββββ¬βββββββββ
β Name β id β mode β status β βΊ β cpu β memory β
ββββββββ΄βββββ΄βββββββ΄βββββββββ΄ββββ΄ββββββ΄βββββββββ
Use `pm2 show <id|name>` to get more details about an app
pi@archivesw:~ $
npm - still choking
Installing required node modules ...
========================================
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
audited 14811 packages in 31.906s
found 1 moderate severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
Complete ...
if I try and fix I get this β¦
pi@archivesw:~ $ npm audit fix
npm ERR! code EAUDITNOPJSON
npm ERR! audit No package.json found: Cannot audit a project without a package.json
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2019-02-25T17_22_41_744Z-debug.log
pi@archivesw:~ $
pi@archivesw:~/archivesw $ pm2 list
ββββββββββ¬βββββ¬βββββββββ¬βββββββββ¬ββββββββββ¬ββββββ¬βββββββββ¬βββββββββ
β Name β id β mode β status β βΊ β cpu β memory β
ββββββββββΌβββββΌβββββββββΌβββββββββΌββββββββββΌββββββΌβββββββββΌβββββββββ€
β Server β 0 β 1.7.13 β fork β errored β 125 β 0% β 0 B β
ββββββββββ΄βββββ΄βββββββββ΄βββββββββ΄ββββββββββ΄ββββββ΄βββββββββ΄βββββββββ
Use `pm2 show <id|name>` to get more details about an app
pi@archivesw:~/archivesw $
pi@archivesw:~/archivesw $ node server
internal/modules/cjs/loader.js:615
throw err;
^
Error: Cannot find module 'body-parser'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:613:15)
at Function.Module._load (internal/modules/cjs/loader.js:539:25)
at Module.require (internal/modules/cjs/loader.js:667:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/home/pi/archivesw/server.js:5:20)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
pi@archivesw:~/archivesw $
also after starting it shows online - before the error. If I monitor I get thisβ¦
Server > at Object.Module._extensions..js
(internal/modules/cjs/loader.js:749:10)
Server > at Module.load (internal/modules/cjs/l
oader.js:630:32)
Server > at tryModuleLoad (internal/modules/cjs
/loader.js:570:12)
Server > at Function.Module._load (internal/mod
ules/cjs/loader.js:562:3) code: 'MODULE_NOT_FOUND'
}
PM2 > App [Server:0] exited with code [1] via
signal [SIGINT]
PM2 > Script /home/pi/archivesw/server.js had too
many unstable restarts (16). Stopped. "errored"
I had downloaded a copy of the install.sh - saved it in /home/pi β
Thatβs what I was runningβ¦ I just ran again from the link you sent. and go this result.
everything clean up to this pointβ¦
Installing required node modules ...
========================================
npm WARN checkPermissions Missing write access to /home/pi/archivesw/node_modules/onoff
npm ERR! path /home/pi/archivesw/node_modules/onoff
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/home/pi/archivesw/node_modules/onoff'
npm ERR! { [Error: EACCES: permission denied, access '/home/pi/archivesw/node_modules/onoff']
npm ERR! stack:
npm ERR! "Error: EACCES: permission denied, access '/home/pi/archivesw/node_modules/onoff'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/home/pi/archivesw/node_modules/onoff' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2019-02-25T18_21_06_088Z-debug.log
Complete ...