Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

npm run package is taking very long time #538

Closed
pierretusseau opened this issue Nov 2, 2015 · 7 comments
Closed

npm run package is taking very long time #538

pierretusseau opened this issue Nov 2, 2015 · 7 comments
Labels

Comments

@pierretusseau
Copy link

Hello,

I'll be short, I used the command "Package" 1 week ago on my laptop, for a quiet heavy theme I built, everything went well.

Today I'm trying the same on my desktop (using W8, my laptop is on W10), on a very light theme and I'm around 30min waiting right now, and still going on ..! I don't know what's happening. How is a such difference possible ? Did I do something wrong ?


EDIT :

Okay there's definitly something wrong. I canceled again, and got this file : http://i.imgur.com/MOaw4K1.png

150Go, this is huge.


EDIT2 :

I closed the console, deleted the 150Go zip file, then tried again to npm run package and I got this result : http://i.imgur.com/2jUaXj3.png

Then I tried to npm run watch and got this : http://i.imgur.com/s91Do2Z.png

@olefredrik
Copy link
Owner

Hmm, wtf. The npm run package command is working well on my side. But there might be an error in the configuration or maybe with the package itself. I'll look into it.

@olefredrik olefredrik added the bug label Nov 2, 2015
@olefredrik
Copy link
Owner

Just completed npm run package in 14.5 sec, resulting in a 2,7MB foundationpress.zip file.

compress

But since it's taking forever and resulting in a giga-file on your machine, there must be something wrong somewhere. The fact that I'm unable to reproduce the bug, makes it more difficult to troubleshoot, though. Can you please verify that your setup in your Gruntfile is identical to this: https://github.com/olefredrik/FoundationPress/blob/master/Gruntfile.js#L9-L30

@olefredrik
Copy link
Owner

@pierretusseau : Okay, I think I found what was causing the strange behaviour.

Here it goes: If you already have a packaged/ folder in your theme directory, the package script will go in an infinite loop and act like a stupid clown, as the packaged folder is not excluded in the compress task in Gruntfile.js. I have a pull request on the way to fix this. Unfortunately there are some issues with the Travis CI build at the moment, so I'm not able to merge the pull request (yet).

Anyway. Here is what you should do:

  1. Delete the pacakged/ folder from your theme directory
  2. Replace the contents of your Gruntfile.js with this and save.
  3. Run npm run package and verify that everything now works as expected.
  4. Leave your packaged/ folder in place and run npm run package one more time, to ensure it still works as expected. You should now have two files in your packaged/ folder, each with a date and timestamp in the filename.

@pierretusseau
Copy link
Author

Okay I just re-created the problem on my laptop, and had the "loop".

I just deleted the packaged/ folder and retry without changer Gruntfile.js code. It worked without problems, just deleting the folder.

Then I went to my gruntfile.js and there's something still odd. The code I got by using your way to download the theme (command line, git clone, ...) is not the same as the one I read in the Github source, I had this : https://gist.github.com/pierretusseau/8e6bfa99b450117e6abe
That may explain why I couldn't browsersync too !

Anyway I'm updating everything and it's working.

You should maybe precise in the readme.md that we may have to delete the folder, waiting for the pull request that should resolve the problem ?


Thanks for your support, I love your work, and I'm learning it to beginner in Wordpress !!

@olefredrik
Copy link
Owner

Thanks a lot! Glad that it worked out for you! I'm waiting for a pull request to be merged in the wordpress-coding-standards repository. As soon as this is in place, I will be able to pass my tests and merge the pull request with a fix for this issue.

(The current situation is that I can't update the readme with a temporary message regarding the package script, as I'm unable to merge any pull request until the build errors are fixed.)

@olefredrik olefredrik reopened this Nov 3, 2015
@olefredrik
Copy link
Owner

Fixed #539

@michaelbrazell
Copy link

Just wanted to add to this that it's not really the folder, but just the .zip file that needs to be deleted. I made the mistake of creating a package once and then went to lunch and came back with a 400GB+ file, that pretty much crashed my desktop using all available space ;)

I just usually delete the existing zip, then run it.

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

No branches or pull requests

3 participants