Seems like the fable compiler doesn't like spaces in path name.
Here is the result when I try to compile my project using Fable.
Mangel Maxime@DESKTOP-1MR6L5C MINGW64 ~/Documents/Visual Studio 2015/Projects/Fa bleTinyEngine/FableTinyEngine
$ fable -t watch --verbose
Fable F# to JS compiler version 0.3.26
npm install
ERROR: npm
ERROR: WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
PROJECT FILE: C:\Users\Mangel Maxime\Documents\Visual Studio 2015\Projects\FableTinyEngine\FableTinyEngine\Browser.fsproj
OUTPUT DIR: C:\Users\Mangel Maxime\Documents\Visual Studio 2015\Projects\FableTinyEngine\FableTinyEngine\temp
WORKING DIR: C:\Users\Mangel Maxime\Documents\Visual Studio 2015\Projects\FableTinyEngine\FableTinyEngine
FABLE COMMAND: cmd /C C:\Users\Mangel Maxime\AppData\Roaming\npm\node_modules\fable-compiler\bin\Fable.Client.Node.exe --copyExt true --target watch --verbose true --module commonjs --sourceMaps true --projFile ./Browser.fsproj --outDir C:\Users\Mangel Maxime\Documents\Visual Studio 2015\Projects\FableTinyEngine\FableTinyEngine\temp --ecma es5
Start compilation...
FABLE ERROR: 'C:\Users\Mangel' is not recognized as an internal or external command,
operable program or batch file.
...
Damn, I thought node's child_process.spawn took care of quoting the arguments when need. This needs to be fixed, thanks for the report!
I need to test this on Windows.
Doing a quick test here. Spaces in project file path appears to be fine:
(Windows 8.1)
C:\Temp\Fable\samples\node>fable --projFile "console with spaces\console.fsproj" --verbose
Fable F# to JS compiler version 0.4.0-alpha
npm install
PROJECT FILE: C:\Temp\Fable\samples\node\console with spaces\console.fsproj
OUTPUT DIR: C:\Temp\Fable\samples\node\console with spaces\out
WORKING DIR: C:\Temp\Fable\samples\node\console with spaces
FABLE COMMAND: cmd /C C:\Users\User\AppData\Roaming\npm\node_modules\fable-compiler\bin\Fable.Client.Node.exe --copyExt true --projFile console.fsproj --verbose true --module commonjs --sourceMaps true --outDir console with spaces\out --ecma es5
Start compilation...
Compiled util.fs at 14:21:37
Compiled index.fs at 14:21:37
node out/index World
Hello dlroW!
However... I believe the problem may appear when the username contains spaces? (e.g. C:\Users\ User With Spaces \AppData...)
Also, I don't know how it worked, actually. Since that
--outDir console with spaces\out
is surely in need of some quotes.
I tested it on Windows and seems to be working so I'm closing the issue :+1: Please feel free to reopen it if you still have problems.
@fdcastel, when you point to a dir where fableconfig.json is present, the paths will be resolved based on the directory where fableconfig.json is, and if the resolved path contains spaces, the argument will to. You can check it by creating a fableconfig.json like { "projFile": "Test.fsx", "outDir": "." } in a directory with spaces.
I just tested the alpha version of fable-compiler under Windows 10 and i still got the same problem.
Fable F# to JS compiler version 0.4.0-alpha
npm install
ERROR: npm
ERROR: WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
PROJECT FILE: c:\Users\Mangel Maxime\Documents\1-Dev\SquiibzSuave\Browser\src\Main.fsx
OUTPUT DIR: c:\Users\Mangel Maxime\Documents\1-Dev\SquiibzSuave\Browser\temp
WORKING DIR: c:\Users\Mangel Maxime\Documents\1-Dev\SquiibzSuave\Browser
FABLE COMMAND: cmd /C C:\Users\Mangel Maxime\AppData\Roaming\npm\node_modules\fable-compiler\bin\Fable.Client.Node.exe --copyExt true --watch true --target watch --verbose true --module commonjs --sourceMaps true --projFile ./src/Main.fsx --outDir c:\Users\Mangel Maxime\Documents\1-Dev\SquiibzSuave\Browser\temp --ecma es5
Start compilation...
FABLE ERROR: 'C:\Users\Mangel' is not recognized as an internal or external command,
operable program or batch file.
...
I tried to execute manually the FABLE COMMAND by adding quotes to the path. And I got this error:
cmd /C "C:\Users\Mangel Maxime\AppData\Roaming\npm\node_modules\fable-compiler\bin\Fable.Client.Node.exe" --copyExt true --watch true --target watch --verbose true --module commonjs --sourceMaps true --projFile ./src/Main.fsx --outDir C:\Users\Mangel Maxime\Documents\1-Dev\SquiibzSuave\Browser\temp --ecma es5
Unhandled Exception: System.InvalidOperationException: The input list was empty.
at Microsoft.FSharp.Collections.FSharpList`1.get_Head()
at Fable.Client.Node.Main.readOpts@38(FSharpMap`2 opts, FSharpList`1 _arg1)
at Fable.Client.Node.Main.readOptions(String[] argv)
at Fable.Client.Node.Main.main(String[] argv)
Strange thing is I really need to place the quotes on the first absolute path.
Not the one for --outDir as it say the FATAL ERROR.
Sorry, this fix didn't make it into alpha. I'll include it in the next release, hopefully in a few hours.
Oh sorry. I was thinking it was in. I will test it again later so.
Could be a good idea to add milestone or label to know the version in which the issue is ?
Yeah, I need to get serious about that. Issues seem to be calming down, so after this release I'll try to write proper release notes for each new version :+1:
@MangelMaxime, I just released 0.4.0 (not alpha) with the fix. Could you please give it a try? Thanks!
I still got an error.
And this time I am at a place where there was no error coming from the path. (see the first line having no space for the working directory).
c:\0-dev\SquiibzSuave\Browser>fable --verbose
Fable F# to JS compiler version 0.4.0
npm install
ERROR: npm
ERROR: WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
PROJECT FILE: c:\0-dev\SquiibzSuave\Browser\src\Main.fsx
OUTPUT DIR: c:\0-dev\SquiibzSuave\Browser\temp
WORKING DIR: c:\0-dev\SquiibzSuave\Browser
FABLE COMMAND: cmd /C "C:\Users\Mangel Maxime\AppData\Roaming\npm\node_modules\fable-compiler\bin\Fable.Client.Node.exe" --copyExt true --verbose true --module commonjs --sourceMaps true --projFile ./src/Main.fsx --outDir c:\0-dev\SquiibzSuave\Browser\temp --ecma es5
Start compilation...
FABLE ERROR: '\"C:\Users\Mangel Maxime\AppData\Roaming\npm\node_modules\fable-compiler\bin\Fable.Client.Node.exe\"' is not recognized as an internal or external command,
operable program or batch file.
...
If I execute this line:
cmd /C "C:\Users\Mangel Maxime\AppData\Roaming\npm\node_modules\fable-compiler\bin\Fable.Client.Node.exe" --copyExt true --verbose true --module commonjs --sourceMaps true --projFile ./src/Main.fsx --outDir c:\0-dev\SquiibzSuave\Browser\temp --ecma es5
I got a bunch of text on the console: (just some extract)
c:\0-dev\SquiibzSuave\Browser>cmd /C "C:\Users\Mangel Maxime\AppData\Roaming\npm\node_modules\fable-compiler\bin\Fable.Client.Node.exe" --copyExt true --verbose true --module commonjs --sourceMaps true --projFile ./src/Main.fsx --outDir c:\0-dev\SquiibzSuave\Browser\temp --ecma es5
{"sourceType":"module","body":[{"specifiers":[{"imported":{"name":"List","type":"Identifier","loc":null},"local":{"name":"$import0","type":"Identifier","loc":null},"type":"ImportSpecifier","loc":null}],"source":{"value":"fable-core","type":"StringLiteral","loc":null},"type":"ImportDeclaration","loc":null},{"specifiers":[{"imported":{"name":"String","type":"Identifier","loc":null},"local":{"name":"$import1","type":"Identifier","loc":null},"type":"ImportSpecifier","loc":null}],"source":{"value":"fable-core","type":"StringLiteral","loc":null},"type":"ImportDeclaration","loc":null},{"specifiers":[{"imported":{"name":"Date","type":"Identifier","loc":null},"local":{"name":"$import2","type":"Identifier","loc":null},"type":"ImportSpecifier","loc":null}],"source":{"value":"fable-core","type":"StringLiteral","loc":null},"type":"ImportDeclaration","loc":null},{"specifiers":[{"imported":{"name":"Seq","type":"Identifier","loc":null},"local":{"name":"$import3","type":"Identifier","loc":null},"type":"ImportSpecifier","loc":null}],"source":{"value":"fable-core","type":"StringLiteral","loc":null},"type":"ImportDeclaration","loc":null},{"declaration":{"declarations":[{"id":{"name":"days","type":"Identifier","loc":null},"init":{"callee":{"object":{"name":"$import0","type":"Identifier","loc":null},"property":{"name":"ofArray","type":"Identifier","loc":null},"computed":false,"type":"MemberExpression","loc":null},"arguments":[{"elements":[{"elements":[{"value":"Sun","type":"StringLiteral","loc":null},{"value":"Dim","type":"StringLiteral","loc":null}],"type":"ArrayExpression","loc":null},{"elements":[{"value":"Mon","type":"StringLiteral","loc":null},{"value":"Lun","type":"StringLiteral","loc":null}],"type":"ArrayExpression","loc":null},{"elements":[{"value":"Tue","type":"StringLiteral","loc":null},{"value":"Mar","type":"StringLiteral","loc":null}],"type":"ArrayExpression","loc":null},{"elements":[{"value":"Web","type":"StringLiteral","loc":null},{"value":"Mer","type":"StringLiteral","loc":null}],"type":"ArrayExpression","loc":null},{"elements":[{"value":"Thu","type":"StringLiteral","loc":null},{"value":"Jeu","type"
It's better than yesterday where I was having FATAL ERROR when executing this command by hand. But still can't compile via fable.
Thanks for checking, this is going to be a bit more complicated than expected. The solutions seems to be here.
Happy to help improve fable.
Cool if you have what you need to fix it :)
Ping me when you need another test ^^
@MangelMaxime, I've released [email protected]. Can you give it a shot please? (fingers crossed)
Hey hey
Everything is working on my personal computer.
With spaces. Without spaces.
I will test this new version on computer at work as it's was crashing todo with 0.4.0
Thanks a lot :)
PS: I just push convince my team at work to try fable for a "Proof of concept" project.
Fantastic, thanks a lot for your collaboration and your patience!
It would be awesome if you can convince your team to use Fable. You know you can count with my support :+1: Also we can put the logo of your company in Fable's website 馃槃
Hey hey will keep you in touch. :)