Build failing

Hi,

I’m currently facing the issue of my (production) build not going through. The assets do not get compressed, the rest seems to work though. As a workaround I currently have to export (not publish!) from the export component again which gets the assets compressed. Then i copy the assets/* into dist/assets/

Looking at the build.log, there’s this warning (ending with “aborting”) and “Build pipeline task did not succeed” right afterwards which is is a bit suspicious.

WARN: [needle-buildpipeline] Output directory not found/created at “S:\xxxx\myproject-web\dist/assets” - aborting

[needle-buildpipeline] - Build pipeline task did not succeed.

Using Unity 2022.3.62f2 and NE 4.10.4-beta (but the problem exists for at least some versions <=4.9).

Edit: Clarified the second export is from the export component. Added versions in use.

Hi krizzl0r,

It looks like the build pipeline isn’t finding or creating the expected assets output folder (dist/assets), which stops the asset compression step from running. In many projects this stems from configuration issues or file system permission problems.

Here are a few steps you can try:

‱ Verify your Needle Engine configuration (usually in needle.config.json). For example, a common setup is to have “buildDirectory” set to “dist” and “assetsDirectory” set to “assets” (as shown in our sample config at nextjs-sample—needle.config.json.md and (docs/needle-config-json.html)). This means your build expects the assets to end up in dist/assets. Double-check that these paths match your project structure.

‱ Ensure that during the build process your system has the necessary permissions to write and create directories in your target location. On Windows (your S:\ drive), a permissions issue could prevent automatic directory creation.

‱ Try cleaning your build output (delete the dist folder) and run a fresh build. Sometimes a stale or corrupted build directory can cause unexpected issues.

‱ If you still face this issue, consider manually creating the dist/assets folder as a temporary workaround or check if your build options (such as using production build with asset compression) require additional tools (e.g., toktx for texture compression).

If none of these help, it might be worth sharing more details (such as the full project configuration via “Copy Project Info Into Clipboard” in Unity) so we can investigate further. Feel free to follow up with additional log details or settings!

Hope this helps.

1 replies left - Become PRO for more replies.
thread_EPWfWdOnhR0LrS7tJtUHgxGN
Reply to this post directly if you need further help (bottom right button)

Hi, do you have more details about your project and did you try the same with the latest versions?

  • Which web framework are you using? (including versions)
  • Do you have C# code that triggers exports or compression runs?
  • Which Nodejs version are you using?

Which web framework are you using? (including versions)

"vite": "<= 4.3.9",

Do you have C# code that triggers exports or compression runs?

No.

Here’s the result of “Copy Project Info Into Clipboard” (with a few props redacted):

{
“ExportInfoGameObjectName”: “Export”,
“ExportInfoGameObjectIsEnabled”: true,
“UnityProjectPath”:
“UnityVersion”: “2022.3.62f2”,
“SceneName”:
“ProjectPath”:
“ProjectDirectoryExists”: true,
“ProjectIsInstalled”: true,
“NeedleEngineInstalled”: true,
“HasNodeInstalled”: true,
“NodeVersion”: “v22.13.1”,
“NpmVersion”: “11.1.0”,
“TypescriptVersion”: "‘tsc’ is not recognized as an internal or external command,; ; operable program or batch file.; ; ",
“HasTokTxInstalled”: true,
“HasMinimumToktxVersionInstalled”: true,
“RenderPipeline”: “URP-HighFidelity (UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset)”,
“GzipEnabled”: true,
“NeedleEngineExporterVersion”: “4.10.4-beta”,
“NeedleEngineVersion”: “4.10.4-beta”,
“NeedleEngineSamplesVersion”: null,
“NeedleEngineExporterPath”: “Packages/com.needle.engine-exporter/package.json”,
“FileStats”: “By Type:\r\n‱\t.glb → x 357 = 17.4 mb\r\n‱\tTotal = 17.4 mb\r\n----\r\nBy Directory:\r\n‱\tassets → x 357 = 17.4 mb\r\n”,
“NeedleComponentsInScene”:
“TypeCacheIsDirty”: false,
“TypeScriptTypes”:
}

Vite is your bundler. But I assume you mean the default vite template which doesn’t use any framework.

Would you be able to send a bugreport with this project so I can check if it reproduces here ?

Oh sorry. Right, it’s a vanilla+x setup.

Sadly, I’m not able to share this project, no :confused:

I’ve tried the same with 4.11.0 (and weeks ago multiple <=4.9 versions) all with the same outcome.

Here’s the 4.11.0 build log, I saw a few more (hopefully relevant) lines:

[needle-buildpipeline] Waiting for output directory to be created
 (S:\xxxx\myproject-web\dist/assets)
[
]
[needle-buildpipeline] Max wait time exceeded - aborting

WARN: [needle-buildpipeline] Output directory not found/created at “S:\xxxx\myproject-web\dist/assets” - aborting

[needle-buildpipeline] - Build pipeline task did not succeed.

Do you happen to have .env variables with NEEDLE_CLOUD_TOKEN (or system variables with this token variable) ?

Maybe you can send the log files e.g. via DM?

In Windows’ env var dialog I can’t see anything like it. Vscode does not find the string anywhere in the project. How else could it slip in there?

I’m building to disk btw

Look at that: It really is a timing problem, the log is not lying. The html/css transformation of the rest of the project takes a while (maybe 30s).

I blindly added some zeros in build-pipeline.js:

 const maxEndTime = startWaitTime + 120_000;
    /** wait until the output directory exists
     * @param {number} iteration
     * @returns {Promise<boolean>}
     */
    function waitForOutputDirectory(iteration) {
function increaseMaxWaitTime(debugLog) {
    maxOutputDirectoryCreatedWaitTime = Date.now();
    let maxWaitTime = 10_00000;
    if (process.env.CI) {
        maxWaitTime += 50_00000;
    }
    maxOutputDirectoryCreatedWaitTime += maxWaitTime;
    if (debugLog) {
        log(`Increased max wait time by ${maxWaitTime / 1000}sec until ${new Date(maxOutputDirectoryCreatedWaitTime).toISOString()}`);
    }
}

And now it builds :smiley:

Interesting! Thanks for the additional info, will look into that!

I think a setting for this can be exposed and the max wait time can be increased as well.

Usually bundling the website doesn’t/shouldnt take as long. Are you also running image optimization or do you have an idea what is taking so long?

There are a few images and fonts but also lots (and LOTS) of legacy css which first is mostly purged. The setup could be nicer but it will have to do for now.

This topic was automatically closed 13 days after the last reply. New replies are no longer allowed.