Open ZeusMonkey opened 4 years ago
Exact same problem!
Our node version is also the same.
pm2: 4.1.2 node: v10.15.2
Any news about this issue ?
pm2 : 4.4.0 node : v10.19.0
unitech@zion:~/keymetrics/pm2-runtime/pm2-critical/npm-start$ pm2 -v
4.4.0
unitech@zion:~/keymetrics/pm2-runtime/pm2-critical/npm-start$ node -v
v10.19.0
unitech@zion:~/keymetrics/pm2-runtime/pm2-critical/npm-start$ pm2 install pm2-logrotate
[PM2][Module] Installing NPM pm2-logrotate module
[PM2][Module] Calling [NPM] to install pm2-logrotate ...
+ pm2-logrotate@2.7.0
added 292 packages from 257 contributors and audited 293 packages in 12.917s
20 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
[PM2][Module] Module downloaded
[PM2][WARN] Applications pm2-logrotate not running, starting...
[PM2] App [pm2-logrotate] launched (1 instances)
Module: pm2-logrotate
$ pm2 set pm2-logrotate:max_size 10M
$ pm2 set pm2-logrotate:retain 30
$ pm2 set pm2-logrotate:compress false
$ pm2 set pm2-logrotate:dateFormat YYYY-MM-DD_HH-mm-ss
$ pm2 set pm2-logrotate:workerInterval 30
$ pm2 set pm2-logrotate:rotateInterval 0 0 * * *
$ pm2 set pm2-logrotate:rotateModule true
Modules configuration. Copy/Paste line to edit values.
[PM2][Module] Module successfully installed and launched
[PM2][Module] Checkout module options: `$ pm2 conf`
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name │ mode │ ↺ │ status │ cpu │ memory │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
Module
┌────┬────────────────────┬──────────┬──────────┬──────────┐
│ id │ name │ status │ cpu │ mem │
├────┼────────────────────┼──────────┼──────────┼──────────┤
│ 0 │ pm2-logrotate │ online │ 0% │ 23.5mb │
└────┴────────────────────┴──────────┴──────────┴──────────┘
Can't reproduce
maybe this can help : https://github.com/facebook/create-react-app/issues/8499 can you dig into pm2/lib/API/Modules/NPM.js:201 ?
Can't see anything in particular: https://github.com/Unitech/pm2/blob/master/lib/API/Modules/NPM.js#L201
https://github.com/Unitech/pm2/blob/master/lib/Utility.js#L206
Here is the code in NPM.js :
Common.printOut(cst.PREFIX_MSG_MOD + 'Calling ' + chalk.bold.red('[NPM]') + ' to install ' + module_name + ' ...');
var canonic_module_name = Utility.getCanonicModuleName(module_name);
var install_path = path.join(cst.DEFAULT_MODULE_PATH, canonic_module_name);
require('mkdirp')(install_path)
.then(function() {
Clearly it crashes in "mkdirp": "1.0.4", is install_path correct ?
there are these issues on mkdirp :
would it be possible that a previous mkdirp (pre 1.x) version is active in some package.json ?
FYI no problem on another server with node --version v12.16.3
I was having this issue on Windows despite having several servers using the same versions without problems. I simply uninstalling the whole of Node and all node_modules including those in ~/AppData/Roaming and everything in my PM2_HOME\modules* directory.
I reinstalled, used a global install on pm2, ran "pm2 install pm2-logrotate" and no longer have an issue.
Update: Found another Windows server with the same issue on a really old version of Node (v8.9.4) - on this one I just manually deleted the pm2 AppData Roaming files and then did a pm2 global install and it worked fine. Seems the issue is something getting corrupted in these folders on Windows.
Any update on this ? I am unable to install pm2-logrotate using the command suggested. On linux as well as windows.
This is the fix. It needs to find the path of the directory where the node binary resides.
echo "Adding nodejs/node*/bin dir to PATH:"
NODE_BIN_PATH="$(dirname "${NODE_PATH}")"
echo $NODE_BIN_PATH
PATH=$NODE_BIN_PATH $PM2_PATH install pm2-logrotate
I got this error when npm wasn't installed on a Centos7 server: "TypeError [ERR_INVALID_ARG_TYPE]: The \"file\" argument must be of type string. Received null", which wasn't the true problem. The true problem was exposed here - "Calling [NPM] to install pm2-logrotate@2.7.0". Verifying the npm version failed since npm wasn't found.
I noticed this problem with a NodeSource Node Installer method with v16.15.0. The NodeSource installer didn't install npm as it should have (https://rpm.nodesource.com/setup_16.x).
Switching to the Node.js installer worked: Steps taken from https://github.com/nodejs/help/wiki/Installation#how-to-install-nodejs-via-binary-archive-on-linux
$ mkdir -p /usr/local/lib/nodejs
$ wget https://nodejs.org/download/release/v16.15.0/node-v16.15.0-linux-x64.tar.xz
$ tar -xJvf node-v16.15.0-linux-x64.tar.xz -C /usr/local/lib/nodejs
Chose to use symbolic link to /usr/bin since this path is already in my PATH environment variable:
$ ln -s /usr/local/lib/nodejs/node-v16.15.0-linux-x64/bin/node /usr/bin/node
$ ln -s /usr/local/lib/nodejs/node-v16.15.0-linux-x64/bin/npm /usr/bin/npm
$ ln -s /usr/local/lib/nodejs/node-v16.15.0-linux-x64/bin/npx /usr/bin/npx
Verified install with:
$ node -v
$ npm version
$ npx -v
Installing pm2-logrotate worked after that.
I am facing the same problem. In a docker image build process where I am using the official PM2 docker file:
FROM keymetrics/pm2:18-alpine
I am trying to install pm2-logrotate using this command a bit further on in the Dockerfile:
RUN pm2 install pm2-logrotate
That doesn't work - the docker image build stops there. When I disable the RUN pm2 install pm2-logrotate
and I enter the container when it is booted up, I get this:
10585f3b9ca5:/src# pm2 install pm2-logrotate assertion failed [result.value != EEXIST]: VmTracker attempted to allocate existing mapping (ThreadContextVm.cpp:47 mmap) Trace/breakpoint trap
This behavior is seen with all other pm2 command. Like:
10585f3b9ca5:/src# pm2 ls assertion failed [result.value != EEXIST]: VmTracker attempted to allocate existing mapping (ThreadContextVm.cpp:47 mmap) Trace/breakpoint trap
I would really appreciate your help in solving this.
pm2: 4.1.1 (tried 4.2.3 before, but same issue) node: 10.15.2