Skip to content

Commit

Permalink
Update doc links contained within code
Browse files Browse the repository at this point in the history
Throw rather than exit if require fails
  • Loading branch information
lovell committed Jan 10, 2020
1 parent 00bcf60 commit a8a0c1e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Have you ensured the platform and version of Node.js used for `npm install` is t

If you are installing as a `root` or `sudo` user, have you tried with the `npm install --unsafe-perm` flag?

If you are using the `ignore-scripts` feature of `npm`, have you tried with the `npm install --ignore-scripts=false` flag?

What is the complete output of running `npm install --verbose sharp`? Have you checked this output for useful error messages?

What is the output of running `npx envinfo --binaries --languages --system --utilities`?
2 changes: 1 addition & 1 deletion install/libvips.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const fail = function (err) {
npmLog.info('sharp', 'Are you trying to install as a root or sudo user? Try again with the --unsafe-perm flag');
}
npmLog.info('sharp', 'Attempting to build from source via node-gyp but this may fail due to the above error');
npmLog.info('sharp', 'Please see https://sharp.pixelplumbing.com/page/install for required dependencies');
npmLog.info('sharp', 'Please see https://sharp.pixelplumbing.com/install for required dependencies');
process.exit(1);
};

Expand Down
13 changes: 9 additions & 4 deletions lib/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@ try {
help.push('- Ensure the version of Node.js used at install time matches that used at runtime');
} else if (/invalid ELF header/.test(err.message)) {
help.push(`- Ensure "${process.platform}" is used at install time as well as runtime`);
} else if (/Cannot find module/.test(err.message)) {
help.push('- Run "npm rebuild --verbose sharp" and look for errors');
} else {
help.push('- Remove the "node_modules/sharp" directory, run "npm install" and look for errors');
help.push(
'- Remove the "node_modules/sharp" directory then run',
' "npm install --ignore-scripts=false --verbose" and look for errors'
);
}
help.push(
'- Consult the installation documentation at https://sharp.pixelplumbing.com/en/stable/install/',
'- Consult the installation documentation at https://sharp.pixelplumbing.com/install',
'- Search for this error at https://github.com/lovell/sharp/issues', ''
);
console.error(help.join('\n'));
process.exit(1);
const error = help.join('\n');
throw new Error(error);
}

// Use NODE_DEBUG=sharp to enable libvips warnings
Expand Down
6 changes: 3 additions & 3 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
// Verify platform and compiler compatibility

#if (VIPS_MAJOR_VERSION < 8 || (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 9))
#error libvips version 8.9.0+ is required - see sharp.pixelplumbing.com/page/install
#error "libvips version 8.9.0+ is required - please see https://sharp.pixelplumbing.com/install"
#endif

#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))
#error GCC version 4.6+ is required for C++11 features - see sharp.pixelplumbing.com/page/install#prerequisites
#error "GCC version 4.6+ is required for C++11 features - please see https://sharp.pixelplumbing.com/install"
#endif

#if (defined(__clang__) && defined(__has_feature))
#if (!__has_feature(cxx_range_for))
#error clang version 3.0+ is required for C++11 features - see sharp.pixelplumbing.com/page/install#prerequisites
#error "clang version 3.0+ is required for C++11 features - please see https://sharp.pixelplumbing.com/install"
#endif
#endif

Expand Down

0 comments on commit a8a0c1e

Please sign in to comment.