How to install pm2-logrotate - pm2

I am trying to install pm2-logrotate,
sudo pm2 install pm2-logrotate
I am getting
[PM2][Module] Installing NPM pm2-logrotate module
[PM2][Module] Calling [NPM] to install pm2-logrotate ...
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/pm2-logrotate failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
npm ERR! A complete log of this run can be found in:
npm ERR! /home/moveoadm/.npm/_logs/2022-09-11T12_58_10_842Z-debug.log
[PM2][ERROR] Installation failed via NPM, module has been restored to prev version

Looks like npm cannot resolve registry.npmjs.org, i.e. it not connected to Internet.
There are a lot of reasons, for instance, docker configuration - look at What's the cause of the error 'getaddrinfo EAI_AGAIN'?

Related

npm install not working, module not found, tried seemingly everything

I have had no issues with installing modules up until now, and I'm not sure what went wrong, as I haven't changed my workflow at all.
I ran:
npm i --save mariadb
in the root directory of my Node project. Then I imported this module:
const mariadb = require("mariadb")
When I try to run, though, I get
Error: Cannot find module 'mariadb'
Looking in node_modules, mariadb indeed is in there, but then looking in package.json, mariadb is not listed in dependencies. I then tried running
npm install --save mariadb
in the src directory to same effect. Then tried
npm install -g mariadb
to same effect. Then tried
rm -rf node_modules
npm install
Same effect, and I also get this error (I assume it must be related somehow):
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/codyray/github.com/cody-a-ray/neighbors/client/node_modules/fsevents
gyp ERR! node -v v12.14.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
> core-js#2.6.11 postinstall /Users/codyray/github.com/cody-a-ray/neighbors/client/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Also, after that last command, every package.json file has the following error:
Problems loading reference 'https://schemastore.azurewebsites.net/schemas/json/package.json': Unable to load schema from 'https://schemastore.azurewebsites.net/schemas/json/package.json': getaddrinfo ENOTFOUND schemastore.azurewebsites.net.
I have no idea what any of this means. Seems very cryptic.
I then tried just manually adding mariadb to my package.json and running
npm install --save
again, to no effect.
God help me
Maybe you should try
npm install mariadb --save
I see you are putting in the wrong order, for more information run this command on your console:
npm help install

npm errors when I try to deploy website to github

getting errors in the terminal when trying to use npm to deploy a website on github
I have no idea what to try
PS C:\Users\user\modern_portfolio> npm run deploy
> modern_portfolio#1.0.0 deploy C:\Users\user\modern_portfolio
> gh-pages -d dist
The "file" argument must be of type string. Received type undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! modern_portfolio#1.0.0 deploy: `gh-pages -d dist`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the modern_portfolio#1.0.0 deploy 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! C:\Users\user\AppData\Roaming\npm-cache\_logs\2019-08-04T04_12_42_515Z-debug.log
Newer version 2.1 has some issue. They are probably working on it. Revert back to 2.0.1.
Reinstall Github pages with a specific version:
npm uninstall gh-pages
npm i gh-pages#2.0.1
npm run deploy // as usual

How to resolve error: EACCES: permission denied when installing Polymer 2.0

Running into an issue trying to install Polymer 2.0
I have node v 8.9.1 installed as well as bower 1.8.2.
To install polymer 2.0, I used the following statements directly from the Polymer install docs:
npm install -g polymer-cli
However, I keep running into this error and don't know how to get around it.
npm WARN deprecated bower#1.8.2: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN deprecated babel-preset-es2015#6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated #types/assert#0.0.29: See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12826
npm ERR! path /usr/local/bin/polymer
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall unlink
npm ERR! Error: EACCES: permission denied, unlink '/usr/local/bin/polymer'
npm ERR! { Error: EACCES: permission denied, unlink '/usr/local/bin/polymer'
npm ERR! cause:
npm ERR! { Error: EACCES: permission denied, unlink '/usr/local/bin/polymer'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'unlink',
npm ERR! path: '/usr/local/bin/polymer' },
npm ERR! stack: 'Error: EACCES: permission denied, unlink \'/usr/local/bin/polymer\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'unlink',
npm ERR! path: '/usr/local/bin/polymer' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jdk588/.npm/_logs/2017-12-04T14_51_46_451Z-debug.log
I've tried running the command with sudo and still no luck.
I am not sure this is the solution but here below from the Polymer page :
What versions of Node.js do we support?
We support all "Current" and "Active LTS" releases of Node.js according to the Node.js Long Term Support Release Schedule, but not "Maintenance" releases.
This means we will support from two to three semver major versions of Node.js, depending on where we are in the Node LTS schedule. Currently we support 6.x and 7.x.
So, try to downgrade the Node ver. to 6.x or 7.x

connect mySQL with Nodejs

i am trying to install mysql Driver for Node.js
but i am getting below error .
can some one will help me ?
Thanks in Advance :)
C:\tmp\node>npm install mysql
npm http GET http://registry.npmjs.org/mysql
npm http GET http://registry.npmjs.org/mysql
npm http GET http://registry.npmjs.org/mysql
npm ERR! network getaddrinfo ENOTFOUND
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! System Windows_NT 5.1.2600
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "mysql"
npm ERR! cwd C:\tmp\node
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.3.5`enter code here`
npm ERR! syscall getaddrinfo
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\tmp\node\npm-debug.log
npm ERR! not ok code 0
Error is not strictly connected to mysql module.
Probably you are behind the proxy, try to follow the instruction how to setup npm behind the proxy here:
http://jjasonclark.com/how-to-setup-node-behind-web-proxy

npm package build failing, how best to debug?

I'm trying to install a mysql node package on Mac OS X. I'm trying to run a client project locally.
I have node and npm installed already and they work fine, other packages have installed fine. I've also compiled/installed the full LAMP stack.
When the build below fails, I'm not seeing any error messages that are helpful - just information about a library not being found. Without knowing what it can't find, I can't fix it.
Any advice? MySQL has been installed the standard way - downloaded packages, ./configure'd, make/install.
$ npm install mysql-libmysqlclient
npm http GET https://registry.npmjs.org/mysql-libmysqlclient
npm http 304 https://registry.npmjs.org/mysql-libmysqlclient
> mysql-libmysqlclient#1.3.3 install /Users/botskonet/node_modules/mysql-libmysqlclient
> node-gyp rebuild
info it worked if it ends with ok
spawn python [ '/Users/botskonet/.node-gyp/0.6.12/tools/gyp_addon',
'binding.gyp',
'-I/Users/botskonet/node_modules/mysql-libmysqlclient/build/config.gypi',
'-f',
'make' ]
spawn make [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings.o
CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_connection.o
CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_result.o
CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_statement.o
SOLINK_MODULE(target) Release/mysql_bindings.node
ld: library not found for -lmysqlclient_r
collect2: ld returned 1 exit status
make: *** [Release/mysql_bindings.node] Error 1
ERR! Error: `make` failed with exit code: 2
at Array.0 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:176:25)
at EventEmitter._tickCallback (node.js:192:40)
ERR! not ok
npm ERR! mysql-libmysqlclient#1.3.3 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the mysql-libmysqlclient#1.3.3 install script.
npm ERR! This is most likely a problem with the mysql-libmysqlclient package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls mysql-libmysqlclient
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Darwin 11.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "mysql-libmysqlclient"
npm ERR! cwd /Users/botskonet/Sites/SportsBuddies
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.15
npm ERR! code ELIFECYCLE
npm ERR! message mysql-libmysqlclient#1.3.3 install: `node-gyp rebuild`
npm ERR! message `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/botskonet/Sites/SportsBuddies/npm-debug.log
npm not ok
Look at the dependencies section in README and issues #107. To build mysql-libmysqlclient you should install both libmysqlclient and development headers for it, add path to your MySQL bin dir to $PATH and path to your MySQL lib dir to $DYLD_LIBRARY_PATH.