mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
fix: check if node.js minimum version is correct (#4002)
This commit is contained in:
parent
c2aa0b6d3f
commit
547ba9a569
1 changed files with 11 additions and 2 deletions
|
@ -1,7 +1,16 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
/* eslint no-sync:0 */
|
const nodeVersion = process.version;
|
||||||
/* eslint no-empty:0 */
|
const versionParts = nodeVersion.slice(1).split('.');
|
||||||
|
|
||||||
|
const majorVersion = parseInt(versionParts[0]);
|
||||||
|
const minorVersion = parseInt(versionParts[1]);
|
||||||
|
|
||||||
|
if (majorVersion < 16 || (majorVersion === 16 && minorVersion < 0)) {
|
||||||
|
throw Error(
|
||||||
|
'"Error: Your Node.js version is not supported. Please upgrade to Node.js 16 or higher for this application to work correctly.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (process.getuid && process.getuid() === 0) {
|
if (process.getuid && process.getuid() === 0) {
|
||||||
process.emitWarning(`Verdaccio doesn't need superuser privileges. don't run it under root`);
|
process.emitWarning(`Verdaccio doesn't need superuser privileges. don't run it under root`);
|
||||||
|
|
Loading…
Reference in a new issue