Skip to content

Commit

Permalink
Improve install time error messages for FreeBSD #1310
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed Aug 4, 2018
1 parent 75556bb commit bd9f238
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Requires libvips v8.6.1.
* Ensure vendor platform mismatch throws error at install time.
[#1303](https://github.com/lovell/sharp/issues/1303)

* Improve install time error messages for FreeBSD users.
[#1310](https://github.com/lovell/sharp/issues/1310)

#### v0.20.5 - 27<sup>th</sup> June 2018

* Expose libjpeg optimize_coding flag.
Expand Down
10 changes: 7 additions & 3 deletions install/libvips.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ try {
} else {
// Is this arch/platform supported?
const arch = process.env.npm_config_arch || process.arch;
if (platform() === 'win32-ia32') {
const platformAndArch = platform();
if (platformAndArch === 'win32-ia32') {
throw new Error('Windows x86 (32-bit) node.exe is not supported');
}
if (arch === 'ia32') {
throw new Error(`Intel Architecture 32-bit systems require manual installation of libvips >= ${minimumLibvipsVersion}\n`);
throw new Error(`Intel Architecture 32-bit systems require manual installation of libvips >= ${minimumLibvipsVersion}`);
}
if (platformAndArch === 'freebsd-x64') {
throw new Error(`FreeBSD systems require manual installation of libvips >= ${minimumLibvipsVersion}`);
}
if (detectLibc.isNonGlibcLinux) {
throw new Error(`Use with ${detectLibc.family} libc requires manual installation of libvips >= ${minimumLibvipsVersion}`);
Expand All @@ -42,7 +46,7 @@ try {
throw new Error(`Use with glibc version ${detectLibc.version} requires manual installation of libvips >= ${minimumLibvipsVersion}`);
}
// Download to per-process temporary file
const tarFilename = ['libvips', minimumLibvipsVersion, platform()].join('-') + '.tar.gz';
const tarFilename = ['libvips', minimumLibvipsVersion, platformAndArch].join('-') + '.tar.gz';
const tarPathTemp = path.join(os.tmpdir(), `${process.pid}-${tarFilename}`);
const tmpFile = fs.createWriteStream(tarPathTemp);
const url = distBaseUrl + tarFilename;
Expand Down

0 comments on commit bd9f238

Please sign in to comment.