HashLips / hashlips_art_engine

HashLips Art Engine is a tool used to create multiple different instances of artworks based on provided layers.
MIT License
7.18k stars 4.3k forks source link

Error: ENOENT, No such file or directory #1344

Open Sviche opened 2 years ago

Sviche commented 2 years ago

Hi, many times running the program, I encounter the same error image my path matches, I can't figure out what the problem is

bolshoytoster commented 2 years ago

@Sviche your username has a unicode character in it, move the project into somewhere like C:/Users/Public/.

CayoGrecco commented 2 years ago

I would like to share an information that I believe is useful and can help. I don't know if many have gone through this, but if someone is having trouble running the command "node index.js or npm run generate" this might help.

(Sorry about this text, but is the same error of the image. just to explain). Error: ENOENT, No such file or directory 'C:\Users\Cayão\Desktop\hashlips_art_engine-main/layers/1_fundo/TheCoolPixelCrewOriginal_0008s_0066_fundo26#3.png' at setSource (C:\Users\Cayão\Desktop\hashlips_art_engine-main\node_modules\canvas\lib\image.js:91:13) at Image.set (C:\Users\Cayão\Desktop\hashlips_art_engine-main\node_modules\canvas\lib\image.js:62:9) at C:\Users\Cayão\Desktop\hashlips_art_engine-main\node_modules\canvas\index.js:34:15 at new Promise () at loadImage (C:\Users\Cayão\Desktop\hashlips_art_engine-main\node_modules\canvas\index.js:23:10) at C:\Users\Cayão\Desktop\hashlips_art_engine-main\src\main.js:185:27 at new Promise () at loadLayerImg (C:\Users\Cayão\Desktop\hashlips_art_engine-main\src\main.js:184:12) at C:\Users\Cayão\Desktop\hashlips_art_engine-main\src\main.js:368:31 at Array.forEach () { errno: 2, code: 'ENOENT', path: 'C:\Users\Cayão\Desktop\hashlips_art_engine-main/layers/1_fundo/TheCoolPixelCrewOriginal_0008s_0066_fundo26#3.png', syscall: 'fopen' "

I will explain the problem and how I solved it. When executing the command "node index.js" the line of code (I don't know if that's how it determines the hashlips...) doesn't find the path of the folder where the file is, in this case:

'C:\Users\Cayão\Desktop\hashlips_art_engine-main/layers/1_fundo/TheCoolPixelCrewOriginal_0008s_0066_fundo26#3.png'(exemplo)

Note that the user's name is accented ("CayÃo"), the line of code when running does not recognize this symbol as written but probably as a code, and for that reason it does not find the path of the file causing this error. Because for the system I believe it understands it as an execution without closing, and it makes no sense in its programming.

      code: 'ENOENT',

path: 'C:\Users\Cayão\Desktop\hashlips_art_engine-main/layers/1_fundo/TheCoolPixelCrewOriginal_0008s_0066_fundo26#3.png', syscall: 'fopen' "

To solve there are two ways that were applicable here:

  1. If you have another PC, where the user is written without accents, hyphens or special characters, just follow the steps in the tutorial(there´s many on YouTube) that "will work"!
  2. But if you, like me, don't have another device, here's what I did to fix the situation:

    • Create a new User with administrator permission on your machine (there are tutorials for that). When creating, don't forget the importance of the name, this is the differential to make it work. in my case it was like this "C:\Users\eu".
    • Log out of your original profile and enter the User that was created;
      • When entering the new profile, enter the folder "C:\Users\" and look for your original profile; double click to open (the system will ask for permission to access, allow);
      • In the folder "C:\Users\Cayão" (my example) look for the hashlips folder and copy to your work area the new profile "C:\Users\eu", also copy your layers;
    • Now with the files in the secondary profile, just follow the information contained in the NFT's creation tutorials, install the Sublime Text or Visual Studio code, and enjoy your NFT's. (I didn't need to reinstall NodeJS because it is configured on the machine's system).

I advise you not to disable this new profile, you will need it to run the command for the contract. And after finishing all the steps, NFT's created, contract done and everything is ok, just enter your main profile and copy from the folder "C:\Users\eu\Desktop\hashlips_art_engine-main\build" (my example).

Sorry for the long text, but it was the best way I could find to try to help. I hope it's helpful. I'm not programmer just a curious, this was the solution to the challenge I was facing, maybe yours is different so with other solutions.

No more, good vibes!

bolshoytoster commented 2 years ago

@CayoGrecco

Note that the user's name is accented ("CayÃo"), the line of code when running does not recognize this symbol as written but probably as a code, and for that reason it does not find the path of the file causing this error. Because for the system I believe it understands it as an execution without closing, and it makes no sense in its programming.

It's because one of our dependencies, node-canvas uses fopen to open files, which (on windows) doesn't support unicode filenames. This means that it interprets the ã as multiple characters instead of one.

I opened an issue on their repo but it's been over 4 months now and I don't like c++.