-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpreinstall.js
More file actions
27 lines (25 loc) · 796 Bytes
/
preinstall.js
File metadata and controls
27 lines (25 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const { exec } = require('child_process');
const os = require("os")
const platform = os.platform()
if(process.env.npm_execpath.indexOf('yarn') === -1) {
throw new Error('Nash SDK must be installed with Yarn: https://yarnpkg.com/')
}
if (platform === "darwin") {
exec('find /usr /opt -name "gmp.h"', (err, stdout, stderr) => {
if (err) {
return
}
const libgmpPaths = stdout.split("\n").filter(line => {
if (line.length === 0) {
return false
}
if (line.includes("Permission denied")) {
return false
}
return true
})
if (libgmpPaths.length === 0) {
throw new Error("To install the Nash Typescript API client you must have libgmp installed. You can install it through homebrew with `brew install gmp`")
}
})
}