Can someone explain how to run the build command with verbose logging?
I've looked at the docs and no matter what way I structure the build command, I get the same level of logging when building.
https://nuxt.com/docs/api/commands/build
I've tried the following
npx nuxi build --logLevel=verbose
npx nuxi build --logLevel 'verbose' npx nuxi build --logLevel='verbose' I get the same level of logs during the build every time. I feel like I'm going insane π
npx nuxi build --logLevel 'verbose' npx nuxi build --logLevel='verbose' I get the same level of logs during the build every time. I feel like I'm going insane π
5 Replies
Hi @ChrisD. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the information provided in the knowledge sources, I can help explain how to run the Nuxt build command with verbose logging.
According to the Nuxt Build Command documentation, the correct syntax for specifying the log level is:
So your first attempt
npx nuxi build --logLevel=verbose
is actually the correct syntax.
However, it's important to note that the default log level for the build command is already set to "info". The Nuxt Configuration documentation mentions that the default log level is "info" unless running in CI or when a TTY is not available.
Given that you're not seeing any difference in the logging output, it's possible that:
1. The "verbose" log level might not provide significantly more information than the "info" level for the build command.
2. There might be an issue with how the log level is being applied in your specific Nuxt setup.
To troubleshoot this, you could try the following:
1. Ensure you're running the latest version of Nuxt. You can use the upgrade command to update to the latest version:
2. Try setting the log level to "silent" to see if it makes a difference:
3. Check your nuxt.config.ts
file to see if there are any logging configurations that might be overriding the command-line option.
If you're still experiencing issues, it might be worth opening a GitHub Discussion or reporting it as a potential bug, as suggested in the Getting Help documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@778616159170854922> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
hmm it seems silent may actually produce fewer logs.
For more context the reason I need the logging is to investigate why my build takes so long
Especially during prerender @kapa.ai
Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on your follow-up question about logging during prerendering, I can provide some additional information that might be helpful.
Recently, there have been improvements made to the logging of prerendering errors in Nuxt. According to a GitHub pull request, the following changes were implemented:
1. The stack trace of errors is now printed out when prerendering.
2. The full error message is printed on the console when prerendering, as opposed to the sanitized 'internal server error' message which was previously shown.
These changes should provide more detailed information during the prerendering process, which can be particularly useful for debugging.
Additionally, if you're using the
generate
command (which includes prerendering), you can use the same --logLevel
option as mentioned for the build
command. The Nuxt Generate Command documentation shows:
However, it's worth noting that there was a recent issue reported regarding prerendering errors not being properly shown in the console. This issue has been addressed in a GitHub pull request, which fixes the problem of SSR logs not being logged in the console.
If you're still not seeing the level of detail you need during prerendering, you might want to consider:
1. Updating to the latest version of Nuxt to ensure you have these recent improvements.
2. Using the debug
option in your nuxt.config.ts
file, which can provide additional logging information. The Nuxt Configuration documentation states:
This will enable debug mode, which prints out hook names and timings on the server, and logs hook arguments in the browser.
If you continue to experience issues with logging during prerendering, it might be beneficial to report your specific case to the Nuxt GitHub repository for further investigation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@778616159170854922> Kapa.ai is still learning and improving, please let me know how I did by reacting below.