Skip to content

Commit

Permalink
throw error if Node version is below 18
Browse files Browse the repository at this point in the history
  • Loading branch information
EliasVincent committed Mar 14, 2023
1 parent 86b62ab commit 472784f
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 3 deletions.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { Server } = require("socket.io");
const { io } = require("socket.io-client");
const term = require( 'terminal-kit' ).terminal;
const Downloader = require("nodejs-file-downloader");
const semver = require('semver');
const platform = os.platform()
const shell = platform === 'win32' ? 'powershell.exe' : 'bash';
class Dalai {
Expand Down Expand Up @@ -117,6 +118,12 @@ class Dalai {
return modelNames
}
async install(...models) {
// Check if current version is greater than or equal to 18
const node_version = process.version;
if (!semver.gte(node_version, '18.0.0')) {
throw new Error("outdated Node version, please install Node 18 or newer")
}

// install llama.cpp to home
let success = await this.exec(`git clone https://github.com/ggerganov/llama.cpp.git ${this.home}`)
if (!success) {
Expand Down
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
"just:fix": "npx prettier --write ."
},
"dependencies": {
"ejs": "^3.1.8",
"express": "^4.18.2",
"node-pty": "^0.10.1",
"nodejs-file-downloader": "^4.10.6",
"semver": "^7.3.8",
"socket.io": "^4.6.1",
"socket.io-client": "^4.6.1",
"terminal-kit": "^3.0.0",
"ejs": "^3.1.8",
"express": "^4.18.2"
"terminal-kit": "^3.0.0"
},
"devDependencies": {
"prettier": "^2.8.4"
Expand Down
19 changes: 19 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,13 @@ lazyness@^1.2.0:
resolved "https://registry.npmjs.org/lazyness/-/lazyness-1.2.0.tgz"
integrity sha512-KenL6EFbwxBwRxG93t0gcUyi0Nw0Ub31FJKN1laA4UscdkL1K1AxUd0gYZdcLU3v+x+wcFi4uQKS5hL+fk500g==

lru-cache@^6.0.0:
version "6.0.0"
resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz"
integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
dependencies:
yallist "^4.0.0"

media-typer@0.3.0:
version "0.3.0"
resolved "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz"
Expand Down Expand Up @@ -665,6 +672,13 @@ sanitize-filename@^1.6.3:
dependencies:
truncate-utf8-bytes "^1.0.0"

semver@^7.3.8:
version "7.3.8"
resolved "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz"
integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==
dependencies:
lru-cache "^6.0.0"

send@0.18.0:
version "0.18.0"
resolved "https://registry.npmjs.org/send/-/send-0.18.0.tgz"
Expand Down Expand Up @@ -847,3 +861,8 @@ xmlhttprequest-ssl@~2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz"
integrity sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==

yallist@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==

0 comments on commit 472784f

Please sign in to comment.