Running into Could not resolve './src/generated/gen.js' from index.html error

I cloned my Needle Engine project fresh, and made sure to nvm use and npm install packages, and have all the Needle Engine packages installed (from steps here:Getting Started & Installation | Needle Engine Documentation). However, I get this error: Could not resolve './src/generated/gen.js' from index.html which I recall is related to the generator script that converts my .ts scripts into the Unity project.

What can I do to get past this error, and get the contents of that generated folder again? I see that I don’t have that entire folder.

Original Post on Discord

by user 690021744479830061

Hi, can you show a screenshot from the browsr console with the error?

How did you start your web project? Via the play button in Unity or by running npm start in the web project?

The folder is generated by the Unity Plugin. If you don’t see the folder but started your project from Unity it would be helpful to know which Unity version + Needle Engine Plugin version (a screenshot of the ExportInfo component would help). Additionally if you have any errors in the Unity console.

Just in case that might be the issue: you can not just open the index.html - you have to run either npm start in the web project (after installing the project) or click Play in the Unity editor with an ExportInfo component pointing to your web porject

Also: Which Needle Engine project did you clone? From where?

Sorry many questions :slightly_smiling_face: if none of the hints/questions above help to figure it out please try to answer as many as you can as it helps us helping you :slightly_smiling_face:

This helped a lot, I realized I needed to ‘Install’ from the Unity project and make sure the node directory was pointing to the correct place. Thank you!

by user 690021744479830061

I was wondering, have you ever run into this error before when running a build?

Could not load /Users/keren@leftfieldlabs.com/Documents/Hybrid/Personal/vps-challenge/Needle/VPSPortal/node_modules/three/examples/jsm/objects/GroundProjectedEnv.js: ENOENT: no such file or directory, open '/Users/keren@leftfieldlabs.com/Documents/Hybrid/Personal/vps-challenge/Needle/VPSPortal/node_modules/three/examples/jsm/objects/GroundProjectedEnv.js'

Is it possible this section in the package.json is not pointing to the correct file?

"@needle-tools/react-three-fiber": "file:./../../Library/PackageCache/com.needle.engine-exporter@3.6.1-pre/Core/Editor/Projects/Templates/

by user 690021744479830061

Like, how would I actually check what value "@needle-tools/react-three-fiber" is supposed to be?

by user 690021744479830061

It worked on the other computer, perhaps because of that particular computer’s directory setup

by user 690021744479830061

This looks like a mismatch of three.js versions in your project - e.g. an older version is locked but Needle Engine requires a newer one?

You can try running clean install from Unity (hold alt + press install button)

That’s fine - this is just our integration between Needle Engine and R3F referenced locally