Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't install pm2-logrotate for Windows #3456

Closed
ghost opened this issue Feb 8, 2018 · 11 comments
Closed

I can't install pm2-logrotate for Windows #3456

ghost opened this issue Feb 8, 2018 · 11 comments

Comments

@ghost
Copy link

ghost commented Feb 8, 2018

I tried install pm2-logrotate, but error was detected.

C:\Users\Administrator\AppData\Roaming\npm\node_modules\pm2\lib\API\Modules\Modularizer.js:148
process.chdir(process.env.HOME);
^

TypeError: Bad argument.
at C:\Users\Administrator\AppData\Roaming\npm\node_modules\pm2\lib\API\Modules\Modularizer.js:148:13
at C:\Users\Administrator\AppData\Roaming\npm\node_modules\pm2\node_modules\mkdirp\index.js:48:26
at FSReqWrap.oncomplete (fs.js:153:5)

Please tell me the solution.

Versions.
pm2 2.9.3
npm 5.5.1
node 8.9.3
Windows Server 2016 Standard

@wallet77
Copy link
Contributor

hi @moto-a,

Could you put here what you have in variable : process.env.HOME ?
process.chdir can only fail if directory doesn't exist or if you don't have rights on it.

@ghost
Copy link
Author

ghost commented Feb 13, 2018

Thank you for your reply.

process.env.HOME is undefined.
I do not know why it is undefined.

@wallet77
Copy link
Contributor

And if you force a value to your HOME variable does it work ?
It's probably an edge case.

@vmarchaud
Copy link
Contributor

@wallet77 Not an edge case, the value of HOME is never set under windows, it's HOME_DIR from memory and also i don't see the point to chdir in this code.

@wallet77
Copy link
Contributor

chdir is the function which throw an error because HOME variable is empty.
For windows it's USERPROFILE variable.

The best (generic) way to achieve this is to use require('os').homedir().

@preraksola
Copy link

When can we expect this to be released? I am still facing this issue in 2.10.3 version.

@wanganjun
Copy link

@preraksola
Thanks @wallet77, i may find a solution.

set HOME=%USERPROFILE%
pm2 install pm2-logrotate

@wallet77
Copy link
Contributor

Hi @preraksola

I will be released with 3.0.0 version. But I don't know when exactly. I hope in a few weeks.

@ghost
Copy link
Author

ghost commented Jun 15, 2018

set HOME=%USERPROFILE%
pm2 install pm2-logrotate

Awesome!!
Thanks to you, this problem has been solved.

@wallet77
Copy link
Contributor

wallet77 commented Jul 4, 2018

PM2 3.0.0 has been released:

$ npm install pm2@latest -g
$ pm2 update

Be aware of breaking changes, especially drop support for node 0.12.
Full list here : https://github.com/Unitech/pm2/blob/master/CHANGELOG.md

inerc pushed a commit to inerc/pm2 that referenced this issue Feb 11, 2020
inerc pushed a commit to inerc/pm2 that referenced this issue Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
@vmarchaud @wallet77 @wanganjun @preraksola and others