-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): improve error message when native binaries are not found f…
- Loading branch information
1 parent
5a42215
commit 0b5cb5b
Showing
5 changed files
with
57 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { output } from '../utils/output'; | ||
|
||
export function assertSupportedPlatform() { | ||
try { | ||
require('./index.js'); | ||
} catch (e) { | ||
let title = ''; | ||
let bodyLines = []; | ||
if ( | ||
process.platform == 'win32' || | ||
process.platform == 'darwin' || | ||
process.platform == 'linux' || | ||
process.platform == 'freebsd' | ||
) { | ||
title = 'Missing Platform Dependency'; | ||
bodyLines = [ | ||
`The Nx CLI could not find or load the native binary for your supported platform (${process.platform}-${process.arch}).`, | ||
'This likely means that optional dependencies were not installed correctly, or your system is missing some system dependencies.', | ||
]; | ||
if (process.env.NX_VERBOSE_LOGGING == 'true') { | ||
bodyLines.push('', 'Additional error information:', e.message); | ||
} | ||
} else { | ||
title = 'Platform not supported'; | ||
bodyLines = [ | ||
`This platform (${process.platform}-${process.arch}) is currently not supported by Nx.`, | ||
]; | ||
} | ||
|
||
bodyLines.push( | ||
'For more information please see https://nx.dev/recipes/ci/troubleshoot-nx-install-issues' | ||
); | ||
|
||
output.error({ | ||
title, | ||
bodyLines, | ||
}); | ||
process.exit(1); | ||
} | ||
} |