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

Can't setup a new instance of OrchardCMS without PathTooLongException #5669

Closed
rtpHarry opened this issue Aug 21, 2015 · 7 comments
Closed

Comments

@rtpHarry
Copy link
Contributor

I've cloned the repo using GitExt as suggested in the setting up a source enlistment documentation.

When I open the solution in Visual Studio Community 2015, run it with F5 and attempt to go though the initial setup screen an exception is thrown from ViewsBackgroundCompilation.cs in GetViewDirectories().

It tries to dig deep into the node_modules folders and eventually gets stuck on this folder:

"~/Modules/Orchard.DynamicForms/node_modules/gulp-minify-css/node_modules/gulp-util/node_modules/dateformat/node_modules/meow/node_modules/indent-string/node_modules/repeating/node_modules/is-finite/node_modules/number-is-nan/"

I don't think that the code should be going through the node_modules folders at all looking for views so I think the code needs to be changed somewhere to skip these folders.

It looks like the offending code that triggers this cascade is in ViewsBackgroundCompilation.cs CompileViews(). On lines 89/90 it does this:

// Leave these at end (as a best effort)
"~/Core", "~/Modules", "~/Themes"

Which sends it off into a spiral of doom.

@rtpHarry
Copy link
Contributor Author

I updated the method to abort that directory if the path contains node_modules and it worked for me.

    private static void GetViewDirectories(IVirtualPathProvider vpp, string directory, IEnumerable<string> extensions, ICollection<string> files) {
        if (directory.Contains("node_modules"))
        {
            return;
        }

        if (vpp.ListFiles(directory).Where(f => extensions.Any(e => f.EndsWith(e, StringComparison.OrdinalIgnoreCase))).Any()) {
            files.Add(directory);
        }

        foreach (var childDirectory in vpp.ListDirectories(directory).OrderBy(d => d, StringComparer.OrdinalIgnoreCase)) {
            GetViewDirectories(vpp, childDirectory, extensions, files);
        }
    }

Can anyone see any knock on effects that this might cause?

@dcinzona
Copy link
Contributor

You need to delete the node_modules folder completely, remove packages.json and gulpfile.js.
1.9.x has been updated to reintroduce gulp in a non-breaking manner in VS 2015.

Also, please note that you will also get the same PathTooLongException for a couple of other modules (Layouts and Azure.Media, I believe). The same process resolves the issue there as well.

@dcinzona
Copy link
Contributor

See commit: 6da6c5c

@Piedone
Copy link
Member

Piedone commented Aug 21, 2015

So you say this is not an issue any more?

@dcinzona
Copy link
Contributor

This was fixed by @DanielStolt in that commit. It's still a very real issue in the current 1.9.1 release

@rtpHarry
Copy link
Contributor Author

Thanks, I did do a search in issues for PathTooLongException which returned 0 results but I now see this was reported in #5446.

I think it's safe to close this issue.

FYI @DanielStolt goes into great detail into the reasoning behind this in #5450

@rtpHarry
Copy link
Contributor Author

I just got around to publishing the site in question today and hit a bunch of errors with the Publish / Deploy feature of Visual Studio.

I'm just posting this here in case anyone else hits the same errors. You need to use 7-zip to delete the files.

Open up 7-zip on its own then navigate to the offending node_module folders and press shift-del to force it to do a straight delete. A normal delete will fail even though it says it will force delete files because they are too long for the recycle bin. Shift-del will do the trick.

After deleting the files mentioned by dcinzona the package created without an issue:

./Orchard.Web/Modules/Orchard.DynamicForms
./Orchard.Web/Modules/Orchard.Layouts
./Orchard.Web/Modules/Orchard.Azure.MediaServices

Delete any of these that you find in this location:

gulpfile.js
package.json
node_modules

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

3 participants