BowlerHatLLC / dts2as

Convert TypeScript definitions (d.ts files) into ActionScript classes and interfaces for use as external libraries with Apache FlexJS
https://www.npmjs.com/package/dts2as
Apache License 2.0
39 stars 4 forks source link

Windows 10: "no such file or directory" and "was unexpected at this time" errors #7

Open datee opened 8 years ago

datee commented 8 years ago

SWC will not build: Following the exact same steps as the dts2as example here, and using the exact same ts-d file : http://nextgenactionscript.com/tutorials/dts2as-typescript-definitions-with-actionscript/

This results in the following error: G:\rs\typescript\pixi>dts2as --outSWC pixijs.swc pixi.js.d.ts

fs.js:584

return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);

               ^

Error: ENOENT: no such file or directory, open 'G:\rs\typescript\pixi\dts2as_generated\pixijs.js' at Error (native) at Object.fs.openSync (fs.js:584:18) at Object.fs.writeFileSync (fs.js:1224:33) at Object. (C:\Users\Tommy\AppData\Roaming\npm\node_modules\dts2as\bin\cli.js:258:4) at Module._compile (module.js:425:26) at Object.Module._extensions..js (module.js:432:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:313:12) at Module.require (module.js:366:17) at require (module.js:385:17)

Same error happens for most tested ts typedefinition files. Using Node-js 5.1.0 on Windows 10 with dts2as@0.6.1

There is no "dts2as_generated" folder, and using the option -outDir does not create one either.

Using Node 4.2.2 the error is different: The SWC could not be created. The generated ActionScript contains compile-time errors." ..and with 4.2.2 using the -outDir option sometimes .as files are created.

Have tested on several win10 computers, and the error is the same...

joshtynjala commented 8 years ago

Thank you for reporting. The dts2as_generated folder should have been created in a previous step. It's strange that it didn't throw an error earlier, though. That may indicate that it's creating the dts2as_generated folder somewhere unexpected.

I tested this version on Windows 8.1, but not on Windows 10. I'll try with Windows 10 to see if I can reproduce too. Maybe something has changed in that version.

datee commented 8 years ago

The issue seem to be related to windows10 alright.. I've tried 3 different windows 10 computers and the bug is the same on all of them...

joshtynjala commented 8 years ago

I can successfully reproduce this issue on Windows 10. I'll get it fixed soon!

datee commented 8 years ago

So trying with 0.6.2 , the error is different... and the same as it was with Node.4.2.2 dts2as --outSWC pixijs.swc pixi.js.d.ts

\FlashDevelop\Tools\apacheflexjs\bin..) was unexpected at this time. Could not create SWC file. The generated ActionScript contains compile-time errors.

joshtynjala commented 8 years ago

I just tested, and everything seems to working correctly for me on Windows 10.

I see that you left out the --flexHome argument. Are you certain that your FLEX_HOME environment variable is set correctly?

joshtynjala commented 8 years ago

I tested using both Node 4.2.2 and 5.1.0. I tried putting a space in the path to FlexJS, since that error seemed like it might indicate that there was a space in your path. I tried using --flexHome and falling back to a valid FLEX_HOME environment variable. I still cannot reproduce on Windows 10 with dts2as 0.6.2.

You could try uninstalling with npm uninstall -g dts2as. Then, reinstall and try again.

datee commented 8 years ago

Hm. I tried that. No change. Yes FLEX_HOME is set up correctly. Using FLEX_HOME ev.var or --flexHome does not change anything either. --outDir creates a folder with all the .as files.. they look correct. But still no swc file. Although the first time i ran the script a dts2as_generated folder appeared, but was removed immediately....

Tried this on several different windows 10 computers too. All give the same error.

joshtynjala commented 8 years ago

What is the full path that you are using for FLEX_HOME or --flexHome?

datee commented 8 years ago

So i found the error :

FlexJS was located in this folder :C:\Program Files (x86)\FlashDevelop\Tools\apacheflexjs\ Moving FlexJS to c:\flexjs\ fixes the problem.

Even though the flexjs path has " " when using --flexHome or is correct with the FLEX_HOME var, i guess the space in the path is still making the script fail...

joshtynjala commented 8 years ago

I don't understand how it could be happening. I also tested with a space in the path today, as I mentioned. In fact, the reason I needed to create version 0.6.1 was to fix an issue on Windows when there were spaces in the path to FlexJS or in the path of the current working directory. This should be addressed already. I'm stumped.

datee commented 8 years ago

Ok, an update : The error is infact NOT the space itself, but the character " ) " ... This single character in the path creates the error. (just the right parentheses, not the left..)

joshtynjala commented 8 years ago

Now, that's interesting. I wondered why your error included a path with ..) at the end

\FlashDevelop\Tools\apacheflexjs\bin..)

Perhaps it is unexpected behavior from Node's path.join(). I'll try to figure out what's happening there.