自从升级到了 V2 版本后一直都是 2.2.0版本的最新版,但是最新版自昨日开始,总是报如下错误:
[@formatjs/intl] An id must be provided to format a message. You can either: 1. Configure your build toolchain with babel-plugin-formatjs or @formatjs/ts-transformer OR 2. Configure your eslint config to include eslint-plugin-formatjs to autofix this issue
Error: [@formatjs/intl] An id must be provided to format a message. You can either:
Configure your build toolchain with babel-plugin-formatjs
or @formatjs/ts-transformer OR
Configure your eslint config to include eslint-plugin-formatjs
to autofix this issue
at r (https://analyze.innei.ren/_next/static/chunks/pages/_app-0e67ddf2180faf84.js:1:150)
at m (https://analyze.innei.ren/_next/static/chunks/pages/_app-0e67ddf2180faf84.js:6:546061)
at Y (https://analyze.innei.ren/_next/static/chunks/pages/_app-0e67ddf2180faf84.js:6:555082)
at I (https://analyze.innei.ren/_next/static/chunks/968-104b6020f0922c66.js:1:5015)
at ab (https://analyze.innei.ren/_next/static/chunks/framework-2c79e2a64abdb08b.js:9:60915)
at ud (https://analyze.innei.ren/_next/static/chunks/framework-2c79e2a64abdb08b.js:9:72801)
at i (https://analyze.innei.ren/_next/static/chunks/framework-2c79e2a64abdb08b.js:9:120370)
at oO (https://analyze.innei.ren/_next/static/chunks/framework-2c79e2a64abdb08b.js:9:99112)
at https://analyze.innei.ren/_next/static/chunks/framework-2c79e2a64abdb08b.js:9:98979
at oF (https://analyze.innei.ren/_next/static/chunks/framework-2c79e2a64abdb08b.js:9:98986)
看了下 GitHub,最新版已经解决了上述问题。遂更新至 2.3.0 并遇到了这个问题。
问题如下:再在建 2.3.0 版本时,遇到了 ✗ Command failed: prisma migrate deploy 的问题,并且报错 Error:P3009
发生这种错误是因为 MySQL 5.7 的重命名语法略有不同,需要修改一下 sql 文件中的语法,来解决这个错误。
打开 umami/db/mysql/migrations/02_report_schema_session_data 文件夹下的 migration.sql 文件,将 文件中的首行至第6行
-- AlterTable
ALTER TABLE "event_data" RENAME COLUMN "event_data_type" TO "data_type";
ALTER TABLE "event_data" RENAME COLUMN "event_date_value" TO "date_value";
ALTER TABLE "event_data" RENAME COLUMN "event_id" TO "event_data_id";
ALTER TABLE "event_data" RENAME COLUMN "event_numeric_value" TO "number_value";
ALTER TABLE "event_data" RENAME COLUMN "event_string_value" TO "string_value";
替换为
-- RenameColumns
ALTER TABLE `event_data` ADD COLUMN data_type INTEGER UNSIGNED AFTER event_data_type;
ALTER TABLE `event_data` ADD COLUMN date_value TIMESTAMP(0) AFTER event_date_value;
ALTER TABLE `event_data` ADD COLUMN event_data_id VARCHAR(36) AFTER event_id;
ALTER TABLE `event_data` ADD COLUMN number_value DECIMAL(19, 4) AFTER event_numeric_value;
ALTER TABLE `event_data` ADD COLUMN string_value VARCHAR(500) AFTER event_string_value;
UPDATE event_data
SET data_type = event_data_type,
date_value = event_date_value,
event_data_id = event_id,
number_value = event_numeric_value,
string_value = event_string_value;
ALTER TABLE `event_data` MODIFY data_type INTEGER UNSIGNED NOT NULL;
ALTER TABLE `event_data` MODIFY event_data_id VARCHAR(36) NOT NULL;
ALTER TABLE `event_data` DROP COLUMN event_data_type;
ALTER TABLE `event_data` DROP COLUMN event_date_value;
ALTER TABLE `event_data` DROP COLUMN event_id;
ALTER TABLE `event_data` DROP COLUMN event_numeric_value;
ALTER TABLE `event_data` DROP COLUMN event_string_value;
ALTER TABLE `event_data` ADD PRIMARY KEY(event_data_id);
保存后,运行下列命令以绕过失败的迁移。
npx prisma migrate resolve --rolled-back "02_report_schema_session_data"
此时再运行 yarn build 即可构建成功。