icon icon indicating copy to clipboard operation
icon copied to clipboard

If you use the nuxt/icon module Build fails when the development server is on.

Open devmini1203 opened this issue 9 months ago β€’ 2 comments

package manager : yarn nuxt version : 3.13.2 @nuxt/icon version : latest ide : vscode ssr : false

Currently, I am developing a project with nuxt ssr false. I need an icon, I installed @nuxt/icon and was developing it without any problems, and I found a problem with the build result not being produced when I proceeded with the generate command.

The error is as follows.

ERROR The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'file:///_entry.js'

at createRequire (node:internal/modules/cjs/loader:1514:13)

The argument 'filename' must be a file URL object, file URL string, or ab

solute path string. Received 'file:///_entry.js'

error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I'm curious about what the problem is. I've done a lot of tests

I found that the error occurred in the following case.

At the terminal of the vscode, first, run the development server using the yarn local. yarn local => nuxt dev --port 3004 --dotenv .env.local After that, open another terminal to perform the yarn generator:test. yarn generate:test => yarn postinstall && nuxt generate --dotenv .env.test This will not finish the build and will fail the build with the error message described above.

Shut down the development server terminal and use the generate command to build well without errors. :(

Of course, you can shut down the development server and generate it, but I decide that I can't shut down the development server, build it, and turn on the development server again, so I leave the issue like this.

I want to use this great module to complete the development. I'd appreciate it if someone could help me.

Image

Image

devmini1203 avatar Feb 11 '25 01:02 devmini1203

Would you be able to provide a reproduction? πŸ™

More info

Why do I need to provide a reproduction?

Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.

What will happen?

If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect.

If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.

How can I create a reproduction?

We have a couple of templates for starting with a minimal reproduction:

πŸ‘‰ https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz πŸ‘‰ https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox

A public GitHub repository is also perfect. πŸ‘Œ

Please ensure that the reproduction is as minimal as possible. See more details in our guide.

You might also find these other articles interesting and/or helpful:

github-actions[bot] avatar Feb 11 '25 09:02 github-actions[bot]

볡제본 을 μ œκ³΅ν•΄ μ£Όμ‹€ 수 μžˆλ‚˜μš” ? πŸ™

더 λ§Žμ€ 정보

μ™œ λ³΅μ œλ³Έμ„ μ œμΆœν•΄μ•Ό ν•©λ‹ˆκΉŒ?

볡제λ₯Ό 톡해 비ꡐ적 μž‘μ€ νŒ€μœΌλ‘œ 문제λ₯Ό μ‹ μ†ν•˜κ²Œ λΆ„λ₯˜ν•˜κ³  ν•΄κ²°ν•  수 μžˆμŠ΅λ‹ˆλ‹€. 이λ₯Ό 톡해 문제의 근원을 λ°œκ²¬ν•˜λŠ” 데 도움이 되며, κ·€ν•˜ λ˜λŠ” 당사가 내릴 수 μžˆλŠ” 가정을 밝힐 μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€.

무슨 일이 μΌμ–΄λ‚ κΉŒμš”?

μž¬ν˜„λ³Έμ„ μ œκ³΅ν•˜μ‹  경우, 라벨을 μ œκ±°ν•˜κ³  문제λ₯Ό μž¬ν˜„ν•΄ λ³΄κ² μŠ΅λ‹ˆλ‹€. μž¬ν˜„μ΄ κ°€λŠ₯ν•˜λ‹€λ©΄ λ²„κ·Έλ‘œ ν‘œμ‹œν•˜κ³  심각도와 영ν–₯을 λ―ΈμΉ  수 μžˆλŠ” μ‚¬λžŒμ˜ μˆ˜μ— 따라 μš°μ„ μˆœμœ„λ₯Ό μ •ν•©λ‹ˆλ‹€.

λ ˆμ΄λΈ”μ΄ 뢙은 μ΄μŠˆκ°€ μ‹€μ§ˆμ μΈ ν™œλ™μ„ λ°›μ§€ λͺ»ν•˜λ©΄ needs reproduction(예: μž¬μƒμ‚° 링크가 μžˆλŠ” μƒˆλ‘œμš΄ λŒ“κΈ€) μš°λ¦¬λŠ” 그것을 닫을 κ²ƒμž…λ‹ˆλ‹€. 그것은 μš°λ¦¬κ°€ μ‹ κ²½ μ“°μ§€ μ•ŠκΈ° λ•Œλ¬Έμ΄ μ•„λ‹™λ‹ˆλ‹€! μ–Έμ œλ“ μ§€ μž¬μƒμ‚°μœΌλ‘œ λŒ“κΈ€μ„ 달면 μš°λ¦¬κ°€ λ‹€μ‹œ μ—΄ κ²ƒμž…λ‹ˆλ‹€.

μ–΄λ–»κ²Œ λ³΅μ œν’ˆμ„ λ§Œλ“€ 수 μžˆλ‚˜μš”?

μš°λ¦¬λŠ” μ΅œμ†Œν•œμ˜ μž¬μƒμ‚°μœΌλ‘œ μ‹œμž‘ν•˜κΈ° μœ„ν•œ λͺ‡ κ°€μ§€ ν…œν”Œλ¦Ώμ„ κ°€μ§€κ³  μžˆμŠ΅λ‹ˆλ‹€:

πŸ‘‰ https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz πŸ‘‰ https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox

곡개 GitHub μ €μž₯μ†Œλ„ μ™„λ²½ν•΄μš”. πŸ‘Œ

κ°€λŠ₯ν•œ ν•œ 볡제λ₯Ό μ΅œμ†Œν™”ν•˜μ‹­μ‹œμ˜€ **. μžμ„Έν•œ λ‚΄μš©μ€ **κ°€μ΄λ“œμ—μ„œ ν™•μΈν•˜μ„Έμš” .

λ‹€μŒμ˜ λ‹€λ₯Έ 기사도 ν₯λ―Έλ‘­κ³ /λ˜λŠ” 도움이 될 수 μžˆμŠ΅λ‹ˆλ‹€.

Hello, thank you for your hard work.

I've created an example project where my GitHub repository is experiencing errors.

The link is as below.

https://github.com/devmini1203/nuxt-icon-generate-error-example

As I've explained before

  1. Run the development server with the yarn local command at the first terminal.
  2. Run the build with the yarn generate command on the second terminal.

There are precautions. Please proceed with the generate command after the development server is turned on for sure.

If an error like mine occurs after testing, I would appreciate it if you could answer it.

Thank you always.

ghost avatar Feb 12 '25 05:02 ghost

We observe a similar bug here.

When I build with npm run build -- --preset=firebase : If the development server is running, , then the bundle size is ~5Mo. When I try to deploy to Firebase hosting, I get the same error as @devmini1203 -> ERROR The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'file:///_entry.js' If the development server is not running, the bundle size is ~8Mo. The difference I noticed is that the 8Mo bundle contains icons related files, which are missing in the 5Mo bundle :

β”œβ”€ .output/server/chunks/_/icons.mjs (985 kB) (253 kB gzip)
β”œβ”€ .output/server/chunks/_/icons.mjs.map (7.36 kB) (119 B gzip)
β”œβ”€ .output/server/chunks/_/icons2.mjs (616 kB) (130 kB gzip)
β”œβ”€ .output/server/chunks/_/icons2.mjs.map (5.28 kB) (117 B gzip)
β”œβ”€ .output/server/chunks/_/icons3.mjs (7.25 MB) (2.67 MB gzip)
β”œβ”€ .output/server/chunks/_/icons3.mjs.map (8.74 kB) (121 B gzip)
β”œβ”€ .output/server/chunks/_/icons4.mjs (893 kB) (221 kB gzip)
β”œβ”€ .output/server/chunks/_/icons4.mjs.map (8.83 kB) (122 B gzip)
β”œβ”€ .output/server/chunks/_/icons5.mjs (1.87 MB) (293 kB gzip)
β”œβ”€ .output/server/chunks/_/icons5.mjs.map (17.7 kB) (131 B gzip)

Thanks @devmini1203 for the tests !

desk-pro avatar Feb 24 '25 11:02 desk-pro

μ—¬κΈ°μ„œλ„ λΉ„μŠ·ν•œ 버그λ₯Ό λ³Ό 수 μžˆμŠ΅λ‹ˆλ‹€.

: 둜 λΉŒλ“œν•  λ•Œ npm run build -- --preset=firebase: 개발 μ„œλ²„κ°€ μ‹€ν–‰ 쀑이면 λ²ˆλ“€ ν¬κΈ°λŠ” ~5Moμž…λ‹ˆλ‹€. Firebase ν˜ΈμŠ€νŒ…μ— λ°°ν¬ν•˜λ €κ³  ν•˜λ©΄ λ‹€μŒκ³Ό 같은 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆλ‹€.@devmini1203-> ERROR The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'file:///_entry.js' 개발 μ„œλ²„κ°€ μ‹€ν–‰ 쀑이 μ•„λ‹ˆλ©΄ λ²ˆλ“€ ν¬κΈ°λŠ” ~8Moμž…λ‹ˆλ‹€. μ œκ°€ μ•Œμ•„μ°¨λ¦° 차이점은 8Mo λ²ˆλ“€μ— 5Mo λ²ˆλ“€μ— μ—†λŠ” μ•„μ΄μ½˜ κ΄€λ ¨ 파일이 λ“€μ–΄ μžˆλ‹€λŠ” κ²ƒμž…λ‹ˆλ‹€.

β”œβ”€ .output/server/chunks/_/icons.mjs (985 kB) (253 kB gzip)
β”œβ”€ .output/server/chunks/_/icons.mjs.map (7.36 kB) (119 B gzip)
β”œβ”€ .output/server/chunks/_/icons2.mjs (616 kB) (130 kB gzip)
β”œβ”€ .output/server/chunks/_/icons2.mjs.map (5.28 kB) (117 B gzip)
β”œβ”€ .output/server/chunks/_/icons3.mjs (7.25 MB) (2.67 MB gzip)
β”œβ”€ .output/server/chunks/_/icons3.mjs.map (8.74 kB) (121 B gzip)
β”œβ”€ .output/server/chunks/_/icons4.mjs (893 kB) (221 kB gzip)
β”œβ”€ .output/server/chunks/_/icons4.mjs.map (8.83 kB) (122 B gzip)
β”œβ”€ .output/server/chunks/_/icons5.mjs (1.87 MB) (293 kB gzip)
β”œβ”€ .output/server/chunks/_/icons5.mjs.map (17.7 kB) (131 B gzip)

κ°μ‚¬ν•΄μš”@devmini1203ν…ŒμŠ€νŠΈλ₯Ό μœ„ν•΄μ„œμš”!

@desk-pro

Hello, thank you so much for sharing regarding the error I am experiencing. It hasn't been resolved yet..

ghost avatar Feb 25 '25 00:02 ghost

I get the same errorImage

xushnudbek20 avatar Mar 06 '25 12:03 xushnudbek20

I get the same errorImage

Hello, ID Xushnudbeck20 Thank you for sharing the same error as me so that faster feedback can come.

ghost avatar Mar 07 '25 00:03 ghost

@antfu Can you help me?

ghost avatar Mar 26 '25 02:03 ghost

Same error using generate and ssr: false

soylomass avatar Apr 17 '25 19:04 soylomass