🐛 [Bug]: 运行 npm run build:runtime 报错
Version
latest
Vue Version
latest
Link to minimal reproduction
无
Step to reproduce
1、Node.js v22.12.0 2、拉取dev分支代码 3、运行 pnpm install 4、运行 npm run build:runtime 5、运行报错
D:\product\tiny-engine\tiny-ui>npm run build:runtime
[email protected] build:runtime pnpm -C internals/cli build:runtime
[email protected] build:runtime D:\product\tiny-engine\tiny-ui\internals\cli pnpm build:entry-app && esno src/index.ts build:runtime
[email protected] build:entry-app D:\product\tiny-engine\tiny-ui\internals\cli esno src/commands/build/build-entry-app.ts
npm run build:entry done. [packages/vue-runtime/all.ts]
npm run build:entry done. [packages/vue-runtime/pc.ts]
npm run build:entry done. [packages/vue-runtime/mobile-first.ts]
npm run build:entry done. [packages/vue-runtime/simple.ts]
====== 开始构建 TINY for vue2: runtime ======
vite v6.1.0 building for production... babelHelpers: 'bundled' option was used by default. It is recommended to configure this option explicitly, read more here: https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers ✓ 106 modules transformed. ../../packages/vue-runtime/dist2/tiny-vue-locale.mjs 186.04 kB │ gzip: 52.67 kB ✓ built in 7.35s
====== 开始构建 TINY for vue2: runtime ======
vite v6.1.0 building for production... babelHelpers: 'bundled' option was used by default. It is recommended to configure this option explicitly, read more here: https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers ✓ 3 modules transformed. x Build failed in 606ms node:internal/process/promises:394 triggerUncaughtException(err, true /* fromPromise */); ^
[vite:css] [less] name is not defined. Maybe you forgot to pass the function to parentFunction? file: D:/product/tiny-engine/tiny-ui/packages/theme/src/base/index.less:undefined:undefined at process (D:\product\tiny-engine\tiny-ui\node_modules.pnpm\[email protected]@[email protected][email protected][email protected][email protected][email protected][email protected][email protected]\node_modules\vite\dist\node\chunks\dep-CfG9u7Cn.js:49998:33) at async compileCSSPreprocessors (D:\product\tiny-engine\tiny-ui\node_modules.pnpm\[email protected]@[email protected][email protected][email protected][email protected][email protected][email protected][email protected]\node_modules\vite\dist\node\chunks\dep-CfG9u7Cn.js:48851:28) at async compileCSS (D:\product\tiny-engine\tiny-ui\node_modules.pnpm\[email protected]_@[email protected][email protected][email protected][email protected][email protected][email protected][email protected]\node_modules\vite\dist\node\chunks\dep-CfG9u7Cn.js:48898:32) at async Object.transform (D:\product\tiny-engine\tiny-ui\node_modules.pnpm\[email protected]_@[email protected][email protected][email protected][email protected][email protected][email protected][email protected]\node_modules\vite\dist\node\chunks\dep-CfG9u7Cn.js:48271:11) at async transform (D:\product\tiny-engine\tiny-ui\node_modules.pnpm\[email protected]\node_modules\rollup\dist\es\shared\node-entry.js:20698:16) at async ModuleLoader.addModuleSource (D:\product\tiny-engine\tiny-ui\node_modules.pnpm\[email protected]\node_modules\rollup\dist\es\shared\node-entry.js:20911:36) { loc: { file: 'D:/product/tiny-engine/tiny-ui/packages/theme/src/base/index.less', line: undefined, column: undefined }, code: 'PLUGIN_ERROR', plugin: 'vite:css', hook: 'transform', id: 'D:/product/tiny-engine/tiny-ui/packages/theme/src/base/index.less', watchFiles: [ 'D:/product/tiny-engine/tiny-ui/packages/vue-common/src/index.ts', 'D:\product\tiny-engine\tiny-ui\packages\vue-common\package.json', 'D:\product\tiny-engine\tiny-ui\packages\vue-hooks\package.json', 'D:/product/tiny-engine/tiny-ui/packages/vue-common/src/adapter/index.ts', 'D:/product/tiny-engine/tiny-ui/packages/vue-common/src/usedefer.ts', 'D:/product/tiny-engine/tiny-ui/packages/vue-common/package.json', 'D:/product/tiny-engine/tiny-ui/packages/vue-common/src/csscls.ts', 'D:/product/tiny-engine/tiny-ui/packages/theme/src/base/index.less' ] }
Node.js v22.12.0
What is expected
无
What is actually happening
无
What is your project name
无
Any additional comments (optional)
No response
It seems like you're encountering an error when running npm run build:runtime in the opentiny/tiny-vue project. The error message indicates a problem with the LESS file, specifically that __name is not defined. This might be due to a missing variable or function in your LESS files.
Here are a few steps you can take to troubleshoot and potentially resolve this issue:
-
Check LESS Files: Look into the
D:/product/tiny-engine/tiny-ui/packages/theme/src/base/index.lessfile and other related LESS files to ensure that all variables and functions are correctly defined and imported. -
LESS Version: Ensure that you are using a compatible version of LESS. Sometimes, updates or mismatches in versions can cause issues.
-
Dependencies: Make sure all dependencies are correctly installed and up to date. You can try removing
node_modulesand reinstalling them usingpnpm install. -
Configuration: Check your Vite and Rollup configurations to ensure that they are set up correctly for handling LESS files.
-
Search for Similar Issues: It's possible that others have encountered and resolved similar issues. Searching through the project's issues or forums might provide additional insights.
If you need further assistance, please let me know, and I can help you search for similar issues or provide more specific guidance.
🪧 Tips
For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me.
Bot detected the issue body's language is not English, translate it automatically.
Title: 🐛 [Bug]: Run npm run build:runtime error
我使用的是 windows 11, vite 6.1.0
Bot detected the issue body's language is not English, translate it automatically.
I'm using windows 11, vite 6.1.0
使用 node v22 会报错,node v18 运行正常
Bot detected the issue body's language is not English, translate it automatically.
Using node v22 will report an error, node v18 will run normally