奇怪的BETWEEN

本文探讨了使用BETWEEN操作符进行日期查询时遇到的问题,发现即使查询区间内的数据存在,也可能因数据库的不同处理方式而无法获取到结果。文章通过实例分析了SQL Server中BETWEEN的具体行为,并对这一现象进行了讨论。

 今天偶然发现BETWEEN的一个问题,我用BETWEEN做了一个日期条件的查询,2个日期是一样的,没有结果,然而库中是有数据的,说明结果中没有包含后一个值的内容,百度了一下,看到这样一句话:

重要事项:不同的数据库对 BETWEEN...AND 操作符的处理方式是有差异的。某些数据库会列出介于 "Adams" 和 "Carter" 之间的人,但不包括 "Adams" 和 "Carter" ;某些数据库会列出介于 "Adams" 和 "Carter" 之间并包括 "Adams" 和 "Carter" 的人;而另一些数据库会列出介于 "Adams" 和 "Carter" 之间的人,包括 "Adams" ,但不包括 "Carter" 。

可是在SQL Server帮助中且看到这样的话:

结果值

如果 test_expression 的值大于或等于 begin_expression 的值并且小于或等于 end_expression 的值,则 BETWEEN 返回 TRUE。

如果 test_expression 的值小于 begin_expression 的值或者大于 end_expression 的值,则 NOT BETWEEN 返回 TRUE。

 

真是无语了,以前不常用BETWEEN,看来以看也不能常用。

gapinyc@DESKTOP-9QS7RL5:~/superset-prod/superset-5.0.0/superset-frontend$ npm run build > superset@5.0.0 build > cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=production BABEL_ENV="${BABEL_ENV:=production}" webpack --color --mode production [Superset Plugin] Use symlink source for @superset-ui/chart-controls @ ./packages/superset-ui-chart-controls [Superset Plugin] Use symlink source for @superset-ui/core @ ./packages/superset-ui-core [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-calendar @ ./plugins/legacy-plugin-chart-calendar [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-chord @ ./plugins/legacy-plugin-chart-chord [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-country-map @ ./plugins/legacy-plugin-chart-country-map [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-horizon @ ./plugins/legacy-plugin-chart-horizon [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-map-box @ ./plugins/legacy-plugin-chart-map-box [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-paired-t-test @ ./plugins/legacy-plugin-chart-paired-t-test [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-parallel-coordinates @ ./plugins/legacy-plugin-chart-parallel-coordinates [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-partition @ ./plugins/legacy-plugin-chart-partition [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-rose @ ./plugins/legacy-plugin-chart-rose [Superset Plugin] Use symlink source for @superset-ui/legacy-plugin-chart-world-map @ ./plugins/legacy-plugin-chart-world-map [Superset Plugin] Use symlink source for @superset-ui/legacy-preset-chart-deckgl @ ./plugins/legacy-preset-chart-deckgl [Superset Plugin] Use symlink source for @superset-ui/legacy-preset-chart-nvd3 @ ./plugins/legacy-preset-chart-nvd3 [Superset Plugin] Use symlink source for @superset-ui/plugin-chart-cartodiagram @ ./plugins/plugin-chart-cartodiagram [Superset Plugin] Use symlink source for @superset-ui/plugin-chart-echarts @ ./plugins/plugin-chart-echarts [Superset Plugin] Use symlink source for @superset-ui/plugin-chart-handlebars @ ./plugins/plugin-chart-handlebars [Superset Plugin] Use symlink source for @superset-ui/plugin-chart-pivot-table @ ./plugins/plugin-chart-pivot-table [Superset Plugin] Use symlink source for @superset-ui/plugin-chart-table @ ./plugins/plugin-chart-table [Superset Plugin] Use symlink source for @superset-ui/plugin-chart-word-cloud @ ./plugins/plugin-chart-word-cloud [Superset Plugin] Use symlink source for @superset-ui/switchboard @ ./packages/superset-ui-switchboard <w> [webpack.cache.PackFileCacheStrategy] Skipped not serializable cache item 'Compilation/modules|/home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/thread-loader/dist/cjs.js!/home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[1].use[1]!/home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/ts-loader/index.js??ruleSet[1].rules[1].use[2]!/home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/src/components/Tooltip/index.tsx': No serializer registered for WorkerError <w> while serializing webpack/lib/cache/PackFileCacheStrategy.PackContentItems -> webpack/lib/NormalModule -> webpack/lib/ModuleBuildError -> WorkerError 1145 assets 12948 modules LOG from ./node_modules/less-loader/dist/cjs.js less-loader ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].use[1]!./node_modules/less-loader/dist/cjs.js??ruleSet[1].rules[6].use[2]!./src/assets/stylesheets/superset.less <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/style/mixins/typography.less on line 15, column 20: <w> 15 .typography-title( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/style/mixins/typography.less on line 24, column 20: <w> 24 .typography-title( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/style/mixins/typography.less on line 33, column 20: <w> 33 .typography-title( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/style/mixins/typography.less on line 42, column 20: <w> 42 .typography-title( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/style/mixins/typography.less on line 51, column 20: <w> 51 .typography-title( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 37, column 20: <w> 37 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 42, column 20: <w> 42 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 50, column 20: <w> 50 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 55, column 20: <w> 55 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 73, column 20: <w> 73 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 84, column 20: <w> 84 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 107, column 22: <w> 107 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 112, column 22: <w> 112 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 129, column 22: <w> 129 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 134, column 22: <w> 134 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 216, column 15: <w> 216 .button-size( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 241, column 17: <w> 241 .button-size( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 246, column 17: <w> 246 .button-size( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 284, column 20: <w> 284 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 290, column 20: <w> 290 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 298, column 20: <w> 298 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 304, column 20: <w> 304 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 395, column 17: <w> 395 .button-size( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 400, column 17: <w> 400 .button-size( <w> LOG from ./node_modules/less-loader/dist/cjs.js less-loader ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].use[1]!./node_modules/less-loader/dist/cjs.js??ruleSet[1].rules[6].use[2]!./src/assets/stylesheets/antd/index.less <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/style/mixins/typography.less on line 15, column 20: <w> 15 .typography-title( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/style/mixins/typography.less on line 24, column 20: <w> 24 .typography-title( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/style/mixins/typography.less on line 33, column 20: <w> 33 .typography-title( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/style/mixins/typography.less on line 42, column 20: <w> 42 .typography-title( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/style/mixins/typography.less on line 51, column 20: <w> 51 .typography-title( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 37, column 20: <w> 37 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 42, column 20: <w> 42 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 50, column 20: <w> 50 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 55, column 20: <w> 55 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 73, column 20: <w> 73 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 84, column 20: <w> 84 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 107, column 22: <w> 107 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 112, column 22: <w> 112 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 129, column 22: <w> 129 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 134, column 22: <w> 134 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 216, column 15: <w> 216 .button-size( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 241, column 17: <w> 241 .button-size( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 246, column 17: <w> 246 .button-size( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 284, column 20: <w> 284 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 290, column 20: <w> 290 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 298, column 20: <w> 298 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 304, column 20: <w> 304 .button-color( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 395, column 17: <w> 395 .button-size( <w> <w> DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/antd/lib/button/style/mixin.less on line 400, column 17: <w> 400 .button-size( <w> ERROR in ./plugins/plugin-chart-handlebars/node_modules/just-handlebars-helpers/lib/helpers/formatters.js 27:24-55 Module not found: Error: Can't resolve 'currencyformatter.js' in '/home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/plugins/plugin-chart-handlebars/node_modules/just-handlebars-helpers/lib/helpers' ERROR in ./src/components/Tooltip/index.tsx Module build failed (from ./node_modules/thread-loader/dist/cjs.js): Thread Loader (Worker 0) error while reading tsconfig.json: [tsl] ERROR in /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/tsconfig.json(20,46) TS1002: Unterminated string literal. at PoolWorker.fromErrorObj (/home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/thread-loader/dist/WorkerPool.js:362:12) at /home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/thread-loader/dist/WorkerPool.js:184:29 at mapSeries (/home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/neo-async/async.js:3625:14) at PoolWorker.onWorkerMessage (/home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/thread-loader/dist/WorkerPool.js:148:34) at Object.loader (/home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/ts-loader/dist/index.js:18:18) ERROR in ./node_modules/@luma.gl/webgl/dist/adapter/webgl-adapter.js 65:38-62 Module not found: Error: Can't resolve './webgl-device' in '/home/gapinyc/superset-prod/superset-5.0.0/superset-frontend/node_modules/@luma.gl/webgl/dist/adapter' Did you mean 'webgl-device.js'? BREAKING CHANGE: The request './webgl-device' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request. ERROR in ./tsconfig.json TS1002: Unterminated string literal. webpack 5.102.1 compiled with 4 errors in 36967 ms gapinyc@DESKTOP-9QS7RL5:~/superset-prod/superset-5.0.0/superset-frontend$
最新发布
10-24
你当前的 `npm run build` 报错已经 **大幅减少**,从 31 个错误降到了 **4 个关键错误**,说明前面的修复措施是有效的! 但你现在遇到了新的致命问题: --- ## ❌ 当前构建失败的根本原因 ```bash ERROR in ./tsconfig.json TS1002: Unterminated string literal. ``` 这个错误表明:你的 `tsconfig.json` 文件中有一个 **未闭合的字符串(比如少了一个引号)**,导致 TypeScript 解析失败。 此外还有两个模块找不到的问题: 1. `Module not found: Error: Can't resolve 'currencyformatter.js'` 2. `Module not found: Error: Can't resolve './webgl-device'` --- # ✅ 最终解决方案(一步一步操作) 我们将按顺序解决这三个核心问题。 --- ## 🔧 Step 1: 修复 `tsconfig.json` 的语法错误(最紧急!) ### 📍 错误定位: > `TS1002: Unterminated string literal.` 意思是你在 JSON 中写了类似 `"name": "value` 这样没有闭合双引号的字符串。 ### ✅ 操作步骤: ```bash nano ~/superset-prod/superset-5.0.0/superset-frontend/tsconfig.json ``` 或者使用任何编辑器打开该文件。 #### 👀 检查以下常见错误点: - 是否有未闭合的字符串?例如: ```json "outDir": "./dist" ``` 应该是: ```json "outDir": "./dist" ``` - 是否有多余逗号导致解析异常? ```json "strict": true, "skipLibCheck": true, ← 最后一个字段不能有逗号 } ``` - 是否有注释?JSON 不支持注释!删除所有 `//` 或 `/* */` #### ✅ 推荐替换为标准 `tsconfig.json` 如果你不确定哪错了,可以直接用下面这个干净版本替换: ```json { "compilerOptions": { "target": "es2018", "lib": ["dom", "dom.iterable", "es6"], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": false, "forceConsistentCasingInFileNames": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", "sourceMap": true, "declaration": false, "noImplicitAny": false, "noFallthroughCasesInSwitch": true, "noUnusedLocals": false, "noUnusedParameters": false, "removeComments": false, "preserveConstEnums": true, "suppressImplicitAnyIndexErrors": true, "baseUrl": ".", "paths": { "@app/*": ["src/*"], "@charts/*": ["../packages/superset-ui-chart/*"] } }, "include": [ "src", "types", "plugins", "packages", "webpack", "babel.config.js", "jest.config.js", "tailwind.config.js" ], "exclude": [ "node_modules", "cypress", "dist" ] } ``` 📌 保存并退出:`Ctrl+O → Enter → Ctrl+X` --- ## 🔧 Step 2: 安装缺失依赖 `currency-formatter` ```bash cd ~/superset-prod/superset-5.0.0/superset-frontend npm install currency-formatter --save ``` 这是 `just-handlebars-helpers` 插件需要但未声明的库。 --- ## 🔧 Step 3: 创建 Webpack 别名修复路径问题 Superset 支持通过 `webpack/overrides.js` 扩展配置。 ### 创建目录和文件: ```bash mkdir -p webpack nano webpack/overrides.js ``` 粘贴以下内容: ```js // webpack/overrides.js module.exports = (config) => { // 修复 handlebars helper 找不到 currencyformatter.js config.resolve.alias['currencyformatter.js'] = require.resolve('currency-formatter'); // 修复 @luma.gl/webgl 的 .js 后缀缺失问题 if (!config.resolve.fullySpecified) { config.resolve.fullySpecified = false; } return config; }; ``` ✅ 这个配置做了两件事: 1. 把 `currencyformatter.js` 映射到 `currency-formatter` 包 2. 关闭“完全指定模块”检查,允许导入不带 `.js` 后缀的模块(解决 `./webgl-device` 报错) --- ## 🔧 Step 4: 清理缓存 & 重新安装依赖(重要) 有时候旧缓存会导致奇怪问题。 ```bash # 删除 node_modules 和 lock 文件 rm -rf node_modules package-lock.json # 重新安装 npm install ``` > ⚠️ 注意:如果网络慢或依赖下载失败,可以尝试: > > ```bash > npm install --legacy-peer-deps > ``` --- ## 🔧 Step 5: 再次尝试构建 ```bash npm run build ``` --- ## ✅ 成功标志 你应该看到: ``` webpack compiled successfully ``` 并且生成了: ``` dist/chunk.*.js dist/superset_theme.css ``` --- ## 💡 常见问题排查清单 | 问题 | 检查方法 | |------|---------| | `Unterminated string literal` | 检查 `tsconfig.json` 是否有缺引号、多逗号、非法注释 | | `currencyformatter.js` 找不到 | 确保已执行 `npm install currency-formatter` 并设置了 alias | | `webgl-device` 找不到 | 确保 `webpack/overrides.js` 存在且生效 | | 构建卡住或内存溢出 | 已设置 `--max_old_space_size=8192`,足够 | --- ## 📁 项目结构最终应如下 ``` superset-frontend/ ├── tsconfig.json ← 已修复语法错误 ├── webpack/ │ └── overrides.js ← 新增:Webpack 配置扩展 ├── package.json └── node_modules/ └── currency-formatter ← 必须存在 ``` ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值