Skip to content

🐛 [Bug]: 运行 npm run build:runtime 报错 #3134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hashiqi12138 opened this issue Mar 17, 2025 · 6 comments
Open

🐛 [Bug]: 运行 npm run build:runtime 报错 #3134

hashiqi12138 opened this issue Mar 17, 2025 · 6 comments
Labels
bug Something isn't working welcome pr 欢迎提交 PR 实现/解决

Comments

@hashiqi12138
Copy link
Contributor

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

opentiny-vue@3.22.0 build:runtime
pnpm -C internals/cli build:runtime

internal-cli@1.0.5-mf.0 build:runtime D:\product\tiny-engine\tiny-ui\internals\cli
pnpm build:entry-app && esno src/index.ts build:runtime

internal-cli@1.0.5-mf.0 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\vite@6.1.0
@types+node@20.17.17_jiti@2.4.2_less@4.2.2_sass@1.84.0_terser@5.38.1_tsx@4.19.2_yaml@2.7.0\node_modules\vite\dist\node\chunks\dep-CfG9u7Cn.js:49998:33)
at async compileCSSPreprocessors (D:\product\tiny-engine\tiny-ui\node_modules.pnpm\vite@6.1.0
@types+node@20.17.17_jiti@2.4.2_less@4.2.2_sass@1.84.0_terser@5.38.1_tsx@4.19.2_yaml@2.7.0\node_modules\vite\dist\node\chunks\dep-CfG9u7Cn.js:48851:28)
at async compileCSS (D:\product\tiny-engine\tiny-ui\node_modules.pnpm\vite@6.1.0_@types+node@20.17.17_jiti@2.4.2_less@4.2.2_sass@1.84.0_terser@5.38.1_tsx@4.19.2_yaml@2.7.0\node_modules\vite\dist\node\chunks\dep-CfG9u7Cn.js:48898:32)
at async Object.transform (D:\product\tiny-engine\tiny-ui\node_modules.pnpm\vite@6.1.0_@types+node@20.17.17_jiti@2.4.2_less@4.2.2_sass@1.84.0_terser@5.38.1_tsx@4.19.2_yaml@2.7.0\node_modules\vite\dist\node\chunks\dep-CfG9u7Cn.js:48271:11)
at async transform (D:\product\tiny-engine\tiny-ui\node_modules.pnpm\rollup@4.34.6\node_modules\rollup\dist\es\shared\node-entry.js:20698:16)
at async ModuleLoader.addModuleSource (D:\product\tiny-engine\tiny-ui\node_modules.pnpm\rollup@4.34.6\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

Copy link

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:

  1. Check LESS Files: Look into the D:/product/tiny-engine/tiny-ui/packages/theme/src/base/index.less file and other related LESS files to ensure that all variables and functions are correctly defined and imported.

  2. LESS Version: Ensure that you are using a compatible version of LESS. Sometimes, updates or mismatches in versions can cause issues.

  3. Dependencies: Make sure all dependencies are correctly installed and up to date. You can try removing node_modules and reinstalling them using pnpm install.

  4. Configuration: Check your Vite and Rollup configurations to ensure that they are set up correctly for handling LESS files.

  5. 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.

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: 🐛 [Bug]: Run npm run build:runtime error

@hashiqi12138
Copy link
Contributor Author

我使用的是 windows 11, vite 6.1.0

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I'm using windows 11, vite 6.1.0

@kagol kagol added bug Something isn't working welcome pr 欢迎提交 PR 实现/解决 labels Mar 20, 2025
@hashiqi12138
Copy link
Contributor Author

使用 node v22 会报错,node v18 运行正常

@Issues-translate-bot
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working welcome pr 欢迎提交 PR 实现/解决
Projects
None yet
Development

No branches or pull requests

3 participants