Trying to setup pm2 to restart the next.js node app on reboot of the server according to Windows: Auto start PM2 and node apps
on reboot and running pm2 ls I get :
anyone have any ideas?
C:\Users\snoruzi>pm2 ls
connect EPERM //./pipe/rpc.sock
[PM2] Spawning PM2 daemon with pm2_home=C:\Users\snoruzi\.pm2
node:events:368
throw er; // Unhandled 'error' event
^
Error: connect EPERM //./pipe/rpc.sock
at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1161:16)
Emitted 'error' event on ReqSocket instance at:
at Socket.<anonymous> (C:\Users\snoruzi\AppData\Roaming\npm\node_modules\pm2\node_modules\pm2-axon\lib\sockets\sock.js:201:49)
at Socket.emit (node:events:390:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4048,
code: 'EPERM',
syscall: 'connect',
address: '//./pipe/rpc.sock'
}
The app is started by running yarn pm2
which runs the file pm2.json - which tells pm2 where the entry point of the node application is
{
"apps": [
{
"name": "centra-website",
"script": "node_modules/next/dist/bin/next",
"args": "start",
"cwd": "./",
"instances": "max",
"exec_mode": "cluster"
}
]
}
Service seems to be added fine and the pathing to executable looks correct
Try making sure that your command prompt is run as administrator. This fixed the issue for me.
I've got an app where the frontend is deployed to Netlify and the Strapi backend is deployed to Heroku. I recently upgraded Strapi from v3.0.6 to v3.1.3. I was previously using PostgresQL in production, so along with the Strapi upgrade I also am attempting to move over to MongoDB.
I'm attempting to deploy my backend to production, however I keep receiving a 503 error and the app crashes. You can see from the error logs below that there is an issue connecting to the Mongo database.
Here are my relevant logs from Heroku:
2020-08-06T15:06:49.848463+00:00 app[web.1]: > backend#0.1.0 start /app
2020-08-06T15:06:49.848464+00:00 app[web.1]: > strapi start
2020-08-06T15:06:49.848465+00:00 app[web.1]:
2020-08-06T15:06:52.238840+00:00 app[web.1]: (node:23) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2020-08-06T15:06:52.238869+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2020-08-06T15:06:52.239130+00:00 app[web.1]: (node:23) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2020-08-06T15:06:52.239199+00:00 app[web.1]: (node:23) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2020-08-06T15:06:52.239276+00:00 app[web.1]: (node:23) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2020-08-06T15:07:10.279519+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=<app-name>.herokuapp.com request_id=9e81f113-1003-42f7-82e7-59296dc1f0f8 fwd="24.19.220.31" dyno= connect= service= status=503 bytes= protocol=https
2020-08-06T15:07:22.242572+00:00 app[web.1]: [2020-08-06T15:07:22.241Z] debug ⛔️ Server wasn't able to start properly.
2020-08-06T15:07:22.243944+00:00 app[web.1]: [2020-08-06T15:07:22.243Z] error Error connecting to the Mongo database. Server selection timed out after 30000 ms
2020-08-06T15:07:22.266318+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-06T15:07:22.266611+00:00 app[web.1]: npm ERR! errno 1
2020-08-06T15:07:22.269156+00:00 app[web.1]: npm ERR! backend#0.1.0 start: `strapi start`
2020-08-06T15:07:22.269330+00:00 app[web.1]: npm ERR! Exit status 1
2020-08-06T15:07:22.269513+00:00 app[web.1]: npm ERR!
2020-08-06T15:07:22.269976+00:00 app[web.1]: npm ERR! Failed at the backend#0.1.0 start script.
2020-08-06T15:07:22.270129+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-06T15:07:22.278069+00:00 app[web.1]:
2020-08-06T15:07:22.278314+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-06T15:07:22.278417+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-06T15_07_22_271Z-debug.log
2020-08-06T15:07:22.355748+00:00 heroku[web.1]: Process exited with status 1
2020-08-06T15:07:22.394507+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-06T15:07:23.802505+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=<app-name>.herokuapp.com request_id=f5876daf-f945-46b8-88c0-08a61106cfc5 fwd="24.19.220.31" dyno= connect= service= status=503 bytes= protocol=https
I've got the Mongo URI env variable set in Heroku and the app runs fine locally. I'm using Mongo Atlas in the free tier, so I'm wondering if that has something to do with it? Does anyone have any ideas what could be the issue?
I spent 24 hours attempting to fix it before making this post, and just like that - a half hour after making this post - I fixed it, thanks to this SO answer. I needed to whitelist the IP address in order to allow the connection between MongoDB and Heroku!
When pushing my app to Bluemix with no local node_modules and adding the passport-idaas-openidconnect dependency I get the following errors, it says the issue is with my app and not npm, but the error is from /home/vcap/app/node_modules/passport-idaas-openidconnect/lib/strategy.js:8:11
ERR module.js:338
ERR;
ERR ^
ERRor: Cannot find module 'jws'
ERR at Function.Module._resolveFilename (module.js:336:15)
ERR at Function.Module._load (module.js:278:25)
ERR at Module.require (module.js:365:17)
ERR at require (module.js:384:17)
ERR at Object.<anonymous> (/home/vcap/app/node_modules/passport-idaas-openidconnect/lib/strategy.js:8:11)
ERR at Module._compile (module.js:460:26)
ERR at Object.Module._extensions..js (module.js:478:10)
ERR at Module.load (module.js:355:32)
ERR at Function.Module._load (module.js:310:12)
ERR at Module.require (module.js:365:17)
ERR at require (module.js:384:17)
ERR! Linux 3.19.0-25-generic
ERR! argv "/home/vcap/app/vendor/node/bin/node" "/home/vcap/app/vendor/node/bin/npm" "start"
ERR! node v0.12.10
ERR! npm v2.14.9
ERR! code ELIFECYCLE
ERR! myapp#0.4.2 start: `node app.js`
ERR! Exit status 1
ERR!
ERR! Failed at the myapp#0.4.2 start script 'node app.js'.
ERR! This is most likely a problem with the myapp package,
ERR! not with npm itself.
ERR! Tell the author that this fails on your system:
ERR! node app.js
ERR! You can get their info via:
ERR! npm owner ls myappe
ERR! There is likely additional logging output above.
ERR! Please include the following file with any support request:
ERR! /home/vcap/app/npm-debug.log
ERR Instance (index 0) failed to start accepting connections
In order to push a Node.js application with SSO capabilities using Bluemix SSO service, you'll need at least the following dependencies in your package.json file:
"dependencies": {
[...]
"cookie-parser": "^1.4.1",
"express": "^4.12.4",
"express-session": "^1.13.0",
"passport": "^0.2.2",
"passport-idaas-openidconnect": "^1.0.0"
[...]
}
Please note that the passport-idaas-openidconnect module works with passport versions 0.1.1 up to 0.3.2. Versions later than 0.3.2 might not work correctly, as reported in Bluemix Single Sign On Docs - Configuring apps.
i am bit confused Please help me.Based on this logs ionic installed or not?`
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/dep-graph/-/dep-graph-1.1.0.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/init-package-json/-/init-packag
e-json-1.9.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/glob/-/glob-4.0.6.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/d8/-/d8-0.4.4.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/cordova-app-hello-world/-/cordo
va-app-hello-world-3.9.0.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/rc/-/rc-0.5.2.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/npmconf/-/npmconf-0.1.16.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/valid-identifier/-/valid-identi
fier-0.0.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm WARN engine cordova-js#4.0.0: wanted: {"node":"~0.10.x"} (current: {"node":"
4.1.2","npm":"2.14.4"})
npm WARN engine npm#1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":
"4.1.2","npm":"2.14.4"})
npm WARN installMany normalize-package-data was bundled with npm#1.3.4, but bund
led package wasn't found in unpacked tree
npm WARN engine xmlbuilder#2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {
"node":"4.1.2","npm":"2.14.4"})
npm ERR! fetch failed https://registry.npmjs.org/domain-browser/-/domain-browser
-1.1.4.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.0.t
gz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/readable-stream/-/readable-stre
am-1.1.13.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/http-browserify/-/http-browseri
fy-1.7.0.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/resolve/-/resolve-1.1.6.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/https-browserify/-/https-browse
rify-0.0.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/insert-module-globals/-/insert-
module-globals-6.6.0.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/shell-quote/-/shell-quote-0.0.1
.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/os-browserify/-/os-browserify-0
.1.2.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/through2/-/through2-1.1.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/shasum/-/shasum-1.0.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/shallow-copy/-/shallow-copy-0.0
.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/vm-browserify/-/vm-browserify-0
.0.4.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/url/-/url-0.10.3.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/JSONStream/-/JSONStream-1.0.6.t
gz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/labeled-stream-splicer/-/labele
d-stream-splicer-1.0.2.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/syntax-error/-/syntax-error-1.1
.4.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/parents/-/parents-1.0.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/tty-browserify/-/tty-browserify
-0.0.0.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/util/-/util-0.10.3.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/querystring-es3/-/querystring-e
s3-0.2.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/path-browserify/-/path-browseri
fy-0.0.0.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/timers-browserify/-/timers-brow
serify-1.4.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/read-only-stream/-/read-only-st
ream-1.1.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/module-deps/-/module-deps-3.9.1
.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/process/-/process-0.11.2.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/stream-browserify/-/stream-brow
serify-1.0.0.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/through2/-/through2-1.1.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/vm-browserify/-/vm-browserify-0
.0.4.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/querystring-es3/-/querystring-e
s3-0.2.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/module-deps/-/module-deps-3.9.1
.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/timers-browserify/-/timers-brow
serify-1.4.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/process/-/process-0.11.2.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
npm ERR! fetch failed https://registry.npmjs.org/stream-browserify/-/stream-brow
serify-1.0.0.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 103.2
45.222.162:443
global#4.3.0 node_modules\global
├── process#0.5.2
└── min-document#2.17.0 (dom-walk#0.1.1)
ionic#1.6.5 node_modules\ionic
├── underscore#1.7.0
├── proxy-middleware#0.7.0
├── connect-livereload#0.5.2
├── progress#1.1.7
├── open#0.0.5
├── colors#0.6.2
├── q#1.0.1
├── async#0.9.2
├── crc#3.2.1
├── ncp#0.4.2
├── semver#4.3.6
├── shelljs#0.2.6
├── cross-spawn#0.2.3 (lru-cache#2.7.0)
├── cli-table#0.3.1 (colors#1.0.3)
├── form-data#0.1.4 (mime#1.2.11, combined-stream#0.0.7)
├── npm#2.1.3
├── event-stream#3.0.20 (pause-stream#0.0.11, stream-combiner#0.0.4, from#0.1.3,
duplexer#0.1.1, split#0.2.10, through#2.3.8, map-stream#0.0.6)
├── xml2js#0.4.4 (sax#0.6.1, xmlbuilder#3.1.0)
├── opbeat-ionic#1.1.3 (console-log-level#1.1.2, json-stringify-safe#5.0.1, stac
kman#0.2.3, after-all#2.0.2)
├── tiny-lr-fork#0.0.5 (debug#0.7.4, qs#0.5.6, faye-websocket#0.4.4, noptify#0.0
.3)
├── finalhandler#0.2.0 (escape-html#1.0.1, debug#2.0.0)
├── connect#3.1.1 (utils-merge#1.0.0, parseurl#1.3.0, finalhandler#0.1.0, debug#
1.0.4)
├── optimist#0.6.0 (wordwrap#0.0.3, minimist#0.0.10)
├── cheerio#0.19.0 (entities#1.1.1, dom-serializer#0.1.0, css-select#1.0.0, loda
sh#3.10.1, htmlparser2#3.8.3)
├── vinyl-fs#0.3.7 (graceful-fs#3.0.8, lodash#2.4.2, strip-bom#1.0.0, through2#0
.6.5, glob-stream#3.1.18, vinyl#0.4.6, glob-watcher#0.0.6, mkdirp#0.5.1)
├── request#2.51.0 (forever-agent#0.5.2, aws-sign2#0.5.0, caseless#0.8.0, tunnel
-agent#0.4.1, oauth-sign#0.5.0, stringstream#0.0.4, json-stringify-safe#5.0.1, m
ime-types#1.0.2, qs#2.3.3, node-uuid#1.4.3, tough-cookie#2.0.0, hawk#1.1.1, comb
ined-stream#0.0.7, bl#0.9.4, form-data#0.2.0, http-signature#0.10.1)
├── serve-static#1.7.1 (escape-html#1.0.1, utils-merge#1.0.0, parseurl#1.3.0, se
nd#0.10.1)
├── unzip#0.1.9 (setimmediate#1.0.2, readable-stream#1.0.33, match-stream#0.0.2,
pullstream#0.4.1, binary#0.3.0, fstream#0.1.31)
├── gulp#3.8.8 (pretty-hrtime#0.2.2, interpret#0.3.10, deprecated#0.0.1, archy#0
.0.2, minimist#1.2.0, semver#3.0.1, chalk#0.5.1, tildify#1.1.1, orchestrator#0.3
.7, gulp-util#3.0.6, liftoff#0.12.1)
├── prompt#0.2.12 (revalidator#0.1.8, pkginfo#0.3.0, read#1.0.7, winston#0.6.2,
utile#0.2.1)
└── ionic-app-lib#0.3.9 (archiver#0.5.2, vinyl-fs#1.0.0, ionic-cordova-lib#5.1.7
)
`
in cmd line i am given npm it showing:npm#2.14.4 C:\Program Files\nodejs\node_modules\npm
and cordova -v :it showing :5.0.0.i am given ionic it showing :**'ionic' is not recognized as an operable program or batch file.**How to Solve these.
Thanks
Type ionic --version to check version of ionic its return like that
1.7.7
its means install ionic in your system.
You can try ionic info as below
C:>ionic info
Your system information:
cordova CLI: 6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.1.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 8.1
Node Version: v4.6.0
Xcode version: Not installed
Thank you.
Try below command:
ionic info
You will get the following information:
Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.8
Node Version: v7.9.0
Xcode version: Not installed