Skip to content

Commit

Permalink
ref: Emit better log message for fallback postinstall script (#1877)
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst authored Dec 28, 2023
1 parent c0f161b commit 59a8ba3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ To fix this, avoid copying the "node_modules" folder, and instead freshly instal
} else {
throw new Error(`Sentry CLI binary for this platform/architecture not found!
It seems like none of the "@sentry/cli" package's optional dependencies got installed. Please make sure your package manager is configured to install optional dependencies. If you are using npm to install your dependencies, please don't set the "--no-optional" or "--omit=optional" flags. Sentry CLI needs the "optionalDependencies" feature in order to install its binary.`);
It seems like none of the "@sentry/cli" package's optional dependencies got installed. Please make sure your package manager is configured to install optional dependencies. If you are using npm to install your dependencies, please don't set the "--no-optional", "--ignore-optional", or "--omit=optional" flags. Sentry CLI needs the "optionalDependencies" feature in order to install its binary.`);
}
}

Expand Down
5 changes: 4 additions & 1 deletion scripts/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,11 @@ try {
process.exit(0);
} catch (e) {
// Optional dependencies likely didn't get installed - proceed with fallback downloading manually
// Log message inspired by esbuild: https://github.com/evanw/esbuild/blob/914f6080c77cfe32a54888caa51ca6ea13873ce9/lib/npm/node-install.ts#L253
logger.log(
`Sentry CLI binary installation via optional dependencies was unsuccessful. Downloading manually instead.`
`Sentry CLI failed to locate the "${distributionPackageName}" package after installation!
This can happen if you use an option to disable optional dependencies during installation, like "--no-optional", "--ignore-optional", or "--omit=optional". Sentry CLI uses the "optionalDependencies" package.json feature to install the correct binary for your platform and operating system. This post-install script will now try to work around this by manually downloading the Sentry CLI binary from the Sentry CDN. If this fails, you need to remove the "--no-optional", "--ignore-optional", and "--omit=optional" flags for Sentry CLI to work.`
);

downloadBinary()
Expand Down

0 comments on commit 59a8ba3

Please sign in to comment.