I’ve been exploring for a fastest and effective HTML5 SDK framework for my HTML5 game and stumble to this Game Closure DevKit by Blackstormlabs, which is also the developer of the popular game Everwing and this SDK is the primary framework for it. But, upon testing on Windows. I got a ERROR problem every time I added an image in the game, and this error always shows up.
[error] Error: EINVAL: invalid argument, utime 'G:\devkit\helloworld\resources\images\test.png' errno: -4071 code: EINVAL syscall: utime path: G:\devkit\helloworld\ resources\images\test.png Unexpected error in stream write-files [build] [error] Error: error in write-files stream build failed
I’ve been checking the Google to fixed this problem and found out the main issue was by a two variable utimes and atimes that are using dates instant that windows don’t understand, windows version require to use the instance of Date() function, for it to work. So, I look for this code and found this on the project directory at MY_PROJECT_NAME/src/build/streams/write-files.js at line 34 and 35 of the code.
var atime = file.stat.atime.getTime(); var mtime = file.stat.mtime.getTime();
To fixed this, we can use New Date() or if you want to retain the timestamp, you can just remove the additional getTime() and this will fixed the error and let you add image in the project.
var atime = file.stat.atime; var mtime = file.stat.mtime;
Checking the repository in Github, I found out that this problem is already fixed and updated. The main issue here is the npm tool is using the old version of devkit and not getting the content to the github repository. I tried uninstalling both cache and the devkit and reinstalling from the github url npm install -g https://github.com/gameclosure/devkit but that doesn’t fixed the problem.
Fixing the Devkit-Core Primarcy Cache Files
The only solution for you not to edit this code every time you create a new project is editing the cache folder of the Devkit-Core. You can do this by editing the file at.
C:\Users\USER_NAME\AppData\Roaming\devkit\cache\devkit-core\src\build\streams\write-files.js
Then edit the following lines or you can grab latest code at Github.
var atime = file.stat.atime; var mtime = file.stat.mtime; if (!isNaN(atime) && !isNaN(mtime)) { return fs.utimesAsync(file.path, atime, mtime); }
Save the file and create your new project. And you can now use images without that error! To update existing project, just delete the modules folder in your project directory.