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

Running into PathTooLongExceptions with our project because we have node_modules. #537

Closed
albertjan opened this issue Sep 8, 2014 · 10 comments

Comments

@albertjan
Copy link
Member

Would it be an idea to add a flag somewhere where you can say I don't care about paths that are too long when globbing?

Or maybe have a list of directories that should be ignored when globbing.

@forki
Copy link
Member

forki commented Sep 8, 2014

@colinbull started to work on a fix - see colinbull@bc52adb

would this help?

@albertjan
Copy link
Member Author

I don't no it might but why plough through the whole node_modules directory when looking for nuget.exe?

@forki
Copy link
Member

forki commented Sep 8, 2014

I added a small quickfix.

If the path scanning fails we just return the default path. So you can override it with your concrete nuget path.

Is this OK?

@albertjan
Copy link
Member Author

Yes it is! Thanks, I was just looking through the code at the fix you did for something similar here: https://github.com/curit/FAKE/blob/master/src/app/FakeLib/Globbing/FileSystem.fs#L147

@forki
Copy link
Member

forki commented Sep 8, 2014

released with 3.4.1

@forki forki closed this as completed Sep 8, 2014
@albertjan
Copy link
Member Author

Very impressive @forki fixed within the hour 👍

@fbeauche
Copy link

fbeauche commented Mar 5, 2015

Is it possible there is a regression on this bug ?
We have path too long exception with RestorePackage when node_modules folder is present:
.\packages\FAKE\tools\FAKE.exe --version

FakePath: C:\dev\ppp\source\gppp\packages\FAKE\tools\FakeLib.dll
FAKE - F# Make "3.18.0"

.\packages\FAKE\tools\FAKE.exe .\build.fsx
F# Interactive for F# 3.1 (private)
Freely distributed under the Apache 2.0 Open Source License

For help type #help;;

[Loading C:\dev\ppp\source\gppp\build.fsx]

System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetDirectoryName(String path)
at System.IO.FileSystemEnumerableIterator1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler1 resultHandler, Boolean checkHost)
at System.IO.Directory.EnumerateFiles(String path, String searchPattern)
at [email protected](String dir) in C:\code\fake\src\app\FakeLib\Globbing\FileSystem.fs:line 53
at [email protected](b& )
at Microsoft.FSharp.Collections.IEnumerator.MapEnumerator1.System-Collections-IEnumerator-MoveNext() at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.takeOuter@674[T,TResult](ConcatEnumerator2 x, Unit unitVar0)
at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable1 source) at Fake.FileSystem.search(String baseDir, String input) in C:\code\fake\src\app\FakeLib\Globbing\FileSystem.fs:line 78 at Fake.FileSystem.System-Collections-Generic-IEnumerable-1-GetEnumerator@109-2.GenerateNext(IEnumerable1& next) in C:\code\fake\src\app\FakeLib\Globbing\FileSystem.fs:line 110
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase1.MoveNextImpl() at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase1.System-Collections-IEnumerator-MoveNext()
at Microsoft.FSharp.Collections.IEnumerator.next@185[T](FSharpFunc2 f, IEnumerator1 e, FSharpRef1 started, Unit unitVar0) at Microsoft.FSharp.Collections.IEnumerator.filter@180.System-Collections-IEnumerator-MoveNext() at Microsoft.FSharp.Collections.IEnumerator.next@185[T](FSharpFunc2 f, IEnumerator1 e, FSharpRef1 started, Unit unitVar0)
at Microsoft.FSharp.Collections.IEnumerator.filter@180.System-Collections-IEnumerator-MoveNext()
at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc2 action, IEnumerable1 source)
at <StartupCode$FSI_0001>.$FSI_0001_Build$fsx.main@() in C:\dev\ppp\source\gppp\build.fsx:line 23
Stopped due to error

@albertjan
Copy link
Member Author

@fbeauche It's not a regression. You just can't have these long paths on windows when using .net. Its a stupid restriction microsoft thought up years and years ago. The fix @forki added was just to prevent fake to go look for nuget.exe by specifying it yourself.

@fbeauche
Copy link

fbeauche commented Mar 5, 2015

Its failing when looking for the packages.config:

let nugetPath = EnvironmentHelper.environVarOrDefault "nugetPath" @"C:\tools\nuget\nuget.exe"
Target "RestorePackages" (fun _ ->
!! "/*/packages.config"
|> Seq.iter (RestorePackage ( fun p -> {p with ToolPath = nugetPath }))
)

@colinbull
Copy link
Contributor

I started working on a fix for this mentioned above, but there is is lots of ins-and-outs when dealing with a long paths. It is probably just best avoided - I couldn't really get it working smoothly which is why I dropped it.

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

No branches or pull requests

4 participants