Skip to content

Commit fe76ed0

Browse files
committed
fix(#68): postinstall is failing with no error
1 parent 68d3424 commit fe76ed0

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

packages/web/scripts/postinstall.mjs

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,30 @@ function isAnalyticsIdInNextConfig() {
6060
}
6161

6262
function main() {
63-
if (!isSpeedInsightsInstalled()) {
64-
// No @vercel/speed-insights installed, we don't need to continue
65-
return;
66-
}
63+
try {
64+
if (!isSpeedInsightsInstalled()) {
65+
// No @vercel/speed-insights installed, we don't need to continue
66+
return;
67+
}
6768

68-
const isInConfig = isAnalyticsIdInNextConfig();
69-
const envFile = findEnvFileWithAnalyticsId();
69+
const isInConfig = isAnalyticsIdInNextConfig();
70+
const envFile = findEnvFileWithAnalyticsId();
7071

71-
if (isInConfig) {
72-
console.warn(
73-
'\x1b[31m',
74-
`Please remove 'analyticsId' from your next.config.js file.`,
75-
);
76-
}
77-
if (envFile) {
78-
console.log(
79-
'\x1b[31m',
80-
`Please remove 'VERCEL_ANALYTICS_ID' from your ${envFile} file.`,
72+
if (isInConfig) {
73+
console.warn(
74+
'\x1b[31m',
75+
`Please remove 'analyticsId' from your next.config.js file.`,
76+
);
77+
}
78+
if (envFile) {
79+
console.log(
80+
'\x1b[31m',
81+
`Please remove 'VERCEL_ANALYTICS_ID' from your ${envFile} file.`,
82+
);
83+
}
84+
} catch (error) {
85+
console.error(
86+
`Failed to run @vercel/speed-insights postinstall script: ${error instanceof Error ? error.message : error}`,
8187
);
8288
}
8389
}

0 commit comments

Comments
 (0)