Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fable compiler doesn't like space in path #249

Closed
MangelMaxime opened this issue Jul 11, 2016 · 16 comments
Closed

Fable compiler doesn't like space in path #249

MangelMaxime opened this issue Jul 11, 2016 · 16 comments
Labels

Comments

@MangelMaxime
Copy link
Member

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: fsevents@1.0.12

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.
...
@alfonsogarciacaro
Copy link
Member

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!

@alfonsogarciacaro
Copy link
Member

I need to test this on Windows.

@fdcastel
Copy link
Contributor

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.

@alfonsogarciacaro
Copy link
Member

I tested it on Windows and seems to be working so I'm closing the issue 👍 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.

@MangelMaxime
Copy link
Member Author

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: fsevents@1.0.14


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.

@alfonsogarciacaro
Copy link
Member

Sorry, this fix didn't make it into alpha. I'll include it in the next release, hopefully in a few hours.

@MangelMaxime
Copy link
Member Author

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 ?

@alfonsogarciacaro
Copy link
Member

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 👍

@alfonsogarciacaro
Copy link
Member

@MangelMaxime, I just released 0.4.0 (not alpha) with the fix. Could you please give it a try? Thanks!

@MangelMaxime
Copy link
Member Author

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: fsevents@1.0.14


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.

@alfonsogarciacaro
Copy link
Member

alfonsogarciacaro commented Jul 21, 2016

Thanks for checking, this is going to be a bit more complicated than expected. The solutions seems to be here.

@MangelMaxime
Copy link
Member Author

Happy to help improve fable.
Cool if you have what you need to fix it :)

Ping me when you need another test ^^

@alfonsogarciacaro
Copy link
Member

alfonsogarciacaro commented Jul 21, 2016

@MangelMaxime, I've released fable-compiler@0.4.1. Can you give it a shot please? (fingers crossed)

@MangelMaxime
Copy link
Member Author

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.

@alfonsogarciacaro
Copy link
Member

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 👍 Also we can put the logo of your company in Fable's website 😄

@MangelMaxime
Copy link
Member Author

Hey hey will keep you in touch. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants