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

Fails on too deeply nested folders in .nw packages #1199

Closed
FredrikNoren opened this issue Oct 13, 2013 · 11 comments
Closed

Fails on too deeply nested folders in .nw packages #1199

FredrikNoren opened this issue Oct 13, 2013 · 11 comments

Comments

@FredrikNoren
Copy link

If you create a .nw package (/zip file) with a too deep folder structure node-webkit fails to unpackage the app with the error message "Cannot extract package. Failed to unzip the package file: package.zip". The zip file can be opened with other programs though so should be a "legit" zip file.

This means for instance lodash.find can't be used since once of it's dependencies resolves into: package.zip\node_modules\lodash.find\node_modules\lodash.forown\node_modules\lodash._basecreatecallback\node_modules\lodash.bind\node_modules\lodash._createbound\node_modules\lodash._createobject\node_module\lodash._noop\

Os: Win7-32bit

@kingFighter
Copy link
Contributor

For me, WinZip is unable to zip the lodash.find because of the long name.

@NathanaelA
Copy link

One thing that you might not know that as long as the logic is the same in node then there is an easy way to work around this. You can actually "flatten" the structure; you can move any sub-module up to its parents node_module folder (all the way up to the top of the node_module tree in fact).
So You could have:
package.zip\node_modules\lodash.find,
package.zip\node_modules\lodash.forown,
... (all the rest) ...
package,zip\node_modules\lodash._noop
-- so that all of them are actually in the main package.zip\node_modules folder.

You can either start out by doing npm install of each sub-component; or you can manually move them to the root node_modules directory from the sub-sub-directory after your done doing a npm install. It does make your root node_modules a little more messy optionally you could put them all in the lodash.find, node_modules folder so they aren't all in the root node_modules folder; it should still work.

Windows has a limit (in several areas) of 255 characters max path; a lot of things will fail when deeper; so it is not recommended you do anything deeper than 255 characters. (And your base path to the package.zip might also be included in that limit depending on how node-webkit is handling the .zip file)

@FredrikNoren
Copy link
Author

Alright so feels like something that's a bit out of scope for node-webkit to do anything about. The simple fix in my case was to use the monolith lodash module instead of the specific ones.

@tomasdev
Copy link

@FredrikNoren why do you think it's not node-webkit scope?

@tomasdev
Copy link

Using Enigma Virtual Box to generate the app, doesn't happen.

@Mithgol
Copy link
Contributor

Mithgol commented Feb 15, 2014

Node-webkit in an amalgamation of Node.js and WebKit, and this issue actually is caused by a similar issue that exists in upstream (Node.js): nodejs/node-v0.x-archive#6960.

@FredrikNoren
Copy link
Author

@tomasdev well if it's a limitation of os and/or zip file format it seems to me like node-webkit can't do much about it, and as @Mithgol say it seems to be a wider problem than just node-webkit.

@tomasdev
Copy link

@FredrikNoren it's not os/zip limitation as you can unzip it with 7zip or any similar tool finely. It's 100% node-webkit related. Although there are workarounds like using Enigma Virtual Box as I previously mentioned, to pack your app in Windows without a problem.

@katanacrimson
Copy link

it certainly is an OS limitation; just because there's workarounds doesn't mean that it's anything but.

references:

http://msdn.microsoft.com/en-us/library/system.io.PathTooLongException.aspx

http://blogs.msdn.com/b/bclteam/archive/2007/02/13/long-paths-in-net-part-1-of-3-kim-hamilton.aspx

windows itself has a maximum on the length of the path (MAX_PATH) at 259 characters (not including the null terminator). including drive and folder, that brings you down to 256 characters. this exists on top of the NTFS maximums.

@faytom
Copy link

faytom commented Mar 21, 2016

@NathanaelA thx buddy it works for me by moving the sub-directory node_modules to its parents node_modules folder. It works like a charm.

@Mithgol
Copy link
Contributor

Mithgol commented Mar 21, 2016

Fortunately, the most recent npm versions (3.x.y) automatically generate much flatter directory structure (most packages coexist under the first level of node_modules unless a conflicting version of a package becomes required and thus is installed deeper), and therefore this issue has few chances to surface nowadays.

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

7 participants