icon
icon copied to clipboard
If you use the nuxt/icon module Build fails when the development server is on.
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.
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:
볡μ λ³Έ μ μ κ³΅ν΄ μ£Όμ€ μ μλμ ? π
λ λ§μ μ 보
μ 볡μ λ³Έμ μ μΆν΄μΌ ν©λκΉ?
볡μ λ₯Ό ν΅ν΄ λΉκ΅μ μμ νμΌλ‘ λ¬Έμ λ₯Ό μ μνκ² λΆλ₯νκ³ ν΄κ²°ν μ μμ΅λλ€. μ΄λ₯Ό ν΅ν΄ λ¬Έμ μ κ·Όμμ λ°κ²¬νλ λ° λμμ΄ λλ©°, κ·ν λλ λΉμ¬κ° λ΄λ¦΄ μ μλ κ°μ μ λ°ν μλ μμ΅λλ€.
λ¬΄μ¨ μΌμ΄ μΌμ΄λ κΉμ?
μ¬νλ³Έμ μ 곡νμ κ²½μ°, λΌλ²¨μ μ κ±°νκ³ λ¬Έμ λ₯Ό μ¬νν΄ λ³΄κ² μ΅λλ€. μ¬νμ΄ κ°λ₯νλ€λ©΄ λ²κ·Έλ‘ νμνκ³ μ¬κ°λμ μν₯μ λ―ΈμΉ μ μλ μ¬λμ μμ λ°λΌ μ°μ μμλ₯Ό μ ν©λλ€.
λ μ΄λΈμ΄ λΆμ μ΄μκ° μ€μ§μ μΈ νλμ λ°μ§ λͺ»νλ©΄
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
- Run the development server with the yarn local command at the first terminal.
- 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.
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 !
μ¬κΈ°μλ λΉμ·ν λ²κ·Έλ₯Ό λ³Ό μ μμ΅λλ€.
: λ‘ λΉλν λ
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..
I get the same error
I get the same error
Hello, ID Xushnudbeck20 Thank you for sharing the same error as me so that faster feedback can come.
@antfu Can you help me?
Same error using generate and ssr: false