How to open project in linux headless

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By vannongtinh

I’m testing my project using a VPS server before deployment
after I type in command: sudo godot -e
I got so many errors, how can I open project? there is no document for it

inh@vps-22-03-19-21-35-00-674:~/mascot$ sudo godot -e
Godot Engine v3.4.4.stable.mono.official.419e713a2 - https://godotengine.org
WARNING: Started the engine as `root`/superuser. This is a security risk, and subsystems like audio may not work correctly.
Set the environment variable `GODOT_SILENCE_ROOT_WARNING` to 1 to silence this warning.
     at: setup2 (main/main.cpp:1301)

Mono: Log file is: '/root/.local/share/godot/mono/mono_logs/2022-03-24_18.17.01_21771.log'
ERROR: Unable to open file: res://.import/CheckboxUncheck64x64.png-cdc774f12f3b1dbc32f03b5db1a54db3.stex.
   at: _load_data (scene/resources/texture.cpp:466)
ERROR: Failed loading resource: res://.import/CheckboxUncheck64x64.png-cdc774f12f3b1dbc32f03b5db1a54db3.stex. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Unable to open file: res://.import/CheckboxCheck64x64.png-e7a479a5c00d73b50e7981adf8b22b11.stex.
   at: _load_data (scene/resources/texture.cpp:466)
ERROR: Failed loading resource: res://.import/CheckboxCheck64x64.png-e7a479a5c00d73b50e7981adf8b22b11.stex. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Unable to open file: res://.import/Radio On64x64.png-1c0eeaab20380382bc440a7c467ad651.stex.
   at: _load_data (scene/resources/texture.cpp:466)
ERROR: Failed loading resource: res://.import/Radio On64x64.png-1c0eeaab20380382bc440a7c467ad651.stex. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Unable to open file: res://.import/Radio Off64x64.png-aa2193a6c5d5ecaad892f90ad20a46c0.stex.
   at: _load_data (scene/resources/texture.cpp:466)
ERROR: Failed loading resource: res://.import/Radio Off64x64.png-aa2193a6c5d5ecaad892f90ad20a46c0.stex. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Unable to open file: res://.import/icon.png-76e0b69d56b253d4bdbfbbba454aaf0c.stex.
   at: _load_data (scene/resources/texture.cpp:466)
ERROR: Failed loading resource: res://.import/icon.png-76e0b69d56b253d4bdbfbbba454aaf0c.stex. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Unable to open file: res://.import/023026.png-7fbf6e7e73b39445d5353f0776247cf5.stex.
   at: _load_data (scene/resources/texture.cpp:466)
ERROR: Failed loading resource: res://.import/023026.png-7fbf6e7e73b39445d5353f0776247cf5.stex. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Cannot open file 'res://.import/character.glb-342edd2179d11a7f1e39d15ecd0cff24.scn'.
   at: load_interactive (core/io/resource_format_binary.cpp:939)
ERROR: Failed loading resource: res://.import/character.glb-342edd2179d11a7f1e39d15ecd0cff24.scn. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Failed loading resource: res://meshes/characters/character/character.glb. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Cannot open file 'res://.import/character.glb-342edd2179d11a7f1e39d15ecd0cff24.scn'.
   at: load_interactive (core/io/resource_format_binary.cpp:939)
ERROR: Failed loading resource: res://.import/character.glb-342edd2179d11a7f1e39d15ecd0cff24.scn. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Failed loading resource: res://meshes/characters/character/character.glb. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
WARNING: Couldn't load external resource: res://meshes/characters/character/character.glb
     at: _parse_ext_resource (scene/resources/resource_format_text.cpp:157)
ERROR: Unable to open file: res://.import/03_Fire_rain_nobg.png-b1324abb52b4c62fc25ea8bb963d1829.stex.
   at: _load_data (scene/resources/texture.cpp:466)
ERROR: Failed loading resource: res://.import/03_Fire_rain_nobg.png-b1324abb52b4c62fc25ea8bb963d1829.stex. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Unable to open file: res://.import/02_Fire_nobg.png-19a18ae1e08c552ad49222eb157f2480.stex.
   at: _load_data (scene/resources/texture.cpp:466)
ERROR: Failed loading resource: res://.import/02_Fire_nobg.png-19a18ae1e08c552ad49222eb157f2480.stex. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Cannot open file 'res://.import/FireDragon.glb-e2ec48276184ce13e73a4b204a319bd3.scn'.
   at: load_interactive (core/io/resource_format_binary.cpp:939)
ERROR: Failed loading resource: res://.import/FireDragon.glb-e2ec48276184ce13e73a4b204a319bd3.scn. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Failed loading resource: res://meshes/creatures/fire_dragon/FireDragon.glb. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Cannot open file 'res://.import/FireDragon.glb-e2ec48276184ce13e73a4b204a319bd3.scn'.
   at: load_interactive (core/io/resource_format_binary.cpp:939)
ERROR: Failed loading resource: res://.import/FireDragon.glb-e2ec48276184ce13e73a4b204a319bd3.scn. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Failed loading resource: res://meshes/creatures/fire_dragon/FireDragon.glb. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
WARNING: Couldn't load external resource: res://meshes/creatures/fire_dragon/FireDragon.glb
     at: _parse_ext_resource (scene/resources/resource_format_text.cpp:157)
ERROR: Cannot open file 'res://.import/character.glb-342edd2179d11a7f1e39d15ecd0cff24.scn'.
   at: get_dependencies (core/io/resource_format_binary.cpp:984)
ERROR: Cannot open file 'res://.import/Cat.glb-1cbb1bc190795afbff926c32df6505e9.scn'.
   at: get_dependencies (core/io/resource_format_binary.cpp:984)
ERROR: Cannot open file 'res://.import/FireDragon.glb-e2ec48276184ce13e73a4b204a319bd3.scn'.
   at: get_dependencies (core/io/resource_format_binary.cpp:984)
ERROR: Cannot open file 'res://.import/Peach.glb-566bc342ef77bd3dc9c6e719c7447e04.scn'.
   at: get_dependencies (core/io/resource_format_binary.cpp:984)
ERROR: Cannot open file 'res://.import/CreaturePhoenix.glb-a8e710190ff09e77d4941fc109def7a0.scn'.
   at: get_dependencies (core/io/resource_format_binary.cpp:984)
Killed

A small suggestion: don’t execute the command as root, i.e. don’t use sudo, because there could be some permission issues when working with the files in the project. Instead, use a normal user account and execute the command from the account’s home directory.

Is the command being executed from the project’s directory? If it isn’t, then it can’t find the editor-specific files in the “.import” directory.

Ertain | 2022-03-25 08:33

:bust_in_silhouette: Reply From: vannongtinh

I read many answers in this topic and many people said “You should not include .import folder in version control”.

And then when I try to use my project in server-headless version. I could not open it like Godot-mono-GUI version.

Reason:

Godot import files and store all config in .stex file and store it in .import folder, and it normal if you are using Godot-mono-GUI version. But in server/headless version there is no way to open project and tell godot to import it.

I solved this problem just by open project in GUI version and let it import and setup necessary configs,
1: I remove .import/ in file .gitignore
2: I commit all contents in .import folder and push it to version control
3: In server-side just get the latest contents from remote by re-clone/ rebase the project
4. build project again using command: godot --path your-project --build-solutions --exit
5. run project: godot --path your-project