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

Windows - Size returned in NaNM for all packages #23

Closed
rayno opened this issue Nov 2, 2016 · 33 comments
Closed

Windows - Size returned in NaNM for all packages #23

rayno opened this issue Nov 2, 2016 · 33 comments

Comments

@rayno
Copy link

rayno commented Nov 2, 2016

Just tried it today on Your OS is Windows 10 64-bit

cost-of-modules --no-install --less

Calculating...


┌─────────────────────────────┬──────────────┬───────┐
│ name                        │ children     │ size  │
├─────────────────────────────┼──────────────┼───────┤
│ react-datepicker            │ 4            │ NaNM  │
├─────────────────────────────┼──────────────┼───────┤
│ sticky-table-headers        │ 0            │ NaNM  │
├─────────────────────────────┼──────────────┼───────┤
│ d3                          │ 0            │ NaNM  │
├─────────────────────────────┼──────────────┼───────┤
│ envify                      │ 21           │ NaNM  │
├─────────────────────────────┼──────────────┼───────┤
│ extract-text-webpack-plugin │ 9            │ NaNM  │
├─────────────────────────────┼──────────────┼───────┤
│ flux-standard-action        │ 5            │ NaNM  │
├─────────────────────────────┼──────────────┼───────┤
│ history                     │ 5            │ NaNM  │
├─────────────────────────────┼──────────────┼───────┤
│ http-server                 │ 19           │ NaNM  │
├─────────────────────────────┼──────────────┼───────┤
│ keypress.js                 │ 0            │ NaNM  │
├─────────────────────────────┼──────────────┼───────┤
│ lodash                      │ 0            │ NaNM  │
├─────────────────────────────┼──────────────┼───────┤
│ + 26 modules                │              │       │
├─────────────────────────────┼──────────────┼───────┤
│ 36 modules                  │ 238 children │ 0.00M │
└─────────────────────────────┴──────────────┴───────┘
@siddharthkp siddharthkp added the bug label Nov 2, 2016
@siddharthkp
Copy link
Owner

siddharthkp commented Nov 2, 2016

@rayno Honestly, I have not tested on windows!

Can you give me the output of du --max-depth 1 -k --exclude ".*" node_modules in your root directory?
That will help.

@rayno
Copy link
Author

rayno commented Nov 2, 2016

Here you are!
debug.txt

@siddharthkp
Copy link
Owner

@rayno That looks, perfectly fine. Not sure what's wrong 🤔

I'll get my hands on a windows machine and debug soon

@siddharthkp
Copy link
Owner

@rayno, Can you help me debug this?

Please clone the repo and run npm test

@rayno
Copy link
Author

rayno commented Nov 7, 2016

Hi again,

When running the tests the linting fails because of line endings.
After removing the lint the tests are not able to run

Output from WebStorm:

npm test

> npm run build && npm run ava


> cost-of-modules@0.4.1 build D:\Projects\cost-of-modules
> babel src -d lib && babel test/src -d test/lib

src\helpers.js -> lib\helpers.js
src\index.js -> lib\index.js
test\src\0prod.js -> test\lib\0prod.js
test\src\1dev.js -> test\lib\1dev.js
test\src\fixtures\dev-test-data.js -> test\lib\fixtures\dev-test-data.js
test\src\fixtures\helpers.js -> test\lib\fixtures\helpers.js
test\src\fixtures\test-data.js -> test\lib\fixtures\test-data.js
test\src\fixtures\tests.js -> test\lib\fixtures\tests.js

> cost-of-modules@0.4.1 ava D:\Projects\cost-of-modules
> ava test/lib -s --no-cache


 - �[?25l�[?25l 
 \  
�[?25l | �[?25l 
 /  
�[?25l - �[?25l 
 \ 

 \ package.json not found!


 \ �[?25l 
 | �[?25l 
 / 

 / package.json not found!

 / 

 / �[?25l�[?25h
   2 exceptions


   × Test results were not received from test\lib\0prod.js


   × Test results were not received from test\lib\1dev.js

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ava"
npm ERR! node v4.1.2
npm ERR! npm  v3.8.7
npm ERR! code ELIFECYCLE
npm ERR! cost-of-modules@0.4.1 ava: `ava test/lib -s --no-cache`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the cost-of-modules@0.4.1 ava script 'ava test/lib -s --no-cache'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the cost-of-modules package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ava test/lib -s --no-cache
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs cost-of-modules
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls cost-of-modules
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Projects\cost-of-modules\npm-debug.log
npm ERR! Test failed.  See above for more details.

Process finished with exit code 1

Output from clink terminal

D:\Projects\cost-of-modules>npm test

> cost-of-modules@0.4.1 test D:\Projects\cost-of-modules
> npm run build && npm run ava


> cost-of-modules@0.4.1 build D:\Projects\cost-of-modules
> babel src -d lib && babel test/src -d test/lib

src\helpers.js -> lib\helpers.js
src\index.js -> lib\index.js
test\src\0prod.js -> test\lib\0prod.js
test\src\1dev.js -> test\lib\1dev.js
test\src\fixtures\dev-test-data.js -> test\lib\fixtures\dev-test-data.js
test\src\fixtures\helpers.js -> test\lib\fixtures\helpers.js
test\src\fixtures\test-data.js -> test\lib\fixtures\test-data.js
test\src\fixtures\tests.js -> test\lib\fixtures\tests.js

> cost-of-modules@0.4.1 ava D:\Projects\cost-of-modules
> ava test/lib -s --no-cache


package.json not found!


package.json not found!


   2 exceptions


   × Test results were not received from test\lib\0prod.js


   × Test results were not received from test\lib\1dev.js

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ava"
npm ERR! node v4.1.2
npm ERR! npm  v3.8.7
npm ERR! code ELIFECYCLE
npm ERR! cost-of-modules@0.4.1 ava: `ava test/lib -s --no-cache`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cost-of-modules@0.4.1 ava script 'ava test/lib -s --no-cache'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the cost-of-modules package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ava test/lib -s --no-cache
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs cost-of-modules
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls cost-of-modules
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Projects\cost-of-modules\npm-debug.log
npm ERR! Test failed.  See above for more details.

I hope that will help!

@siddharthkp
Copy link
Owner

siddharthkp commented Nov 7, 2016

@rayno Interesting, it could not even find package.json!

Are you open to a screen sharing debug session?

@rayno
Copy link
Author

rayno commented Nov 10, 2016

Yes, weekdays from 11-17 EET time.

@siddharthkp
Copy link
Owner

@rayno, Finally tried this on a windows machine, turns out du is not supported at all in the command prompt

When you gave me debug.txt, did you run it on a specific terminal?

@rayno
Copy link
Author

rayno commented Nov 16, 2016

Yes, you are right. I used git bash for that.

@siddharthkp
Copy link
Owner

siddharthkp commented Nov 16, 2016

@rayno, Can you run this command for me in your directory -

du --max-depth 1 -k --exclude ".*" node_modules/

@rayno
Copy link
Author

rayno commented Nov 17, 2016

Already did that, see the attachment debug.txt. The command was ran in git bash since it does not exist in windows environment.
P.S.: It works in git bash, a bit slow though.

@siddharthkp
Copy link
Owner

siddharthkp commented Nov 17, 2016

@rayno, sorry about that. I completely forgot.

I still don't have an idea, why does it fail 😞

I'll get my hands on a windows machine and try again this week. Thanks for being patient.

@siddharthkp siddharthkp changed the title Size returned in NaNM for all packages Windows - Size returned in NaNM for all packages Nov 18, 2016
@pixelis0x
Copy link

same issue win8.1

@tomapp
Copy link

tomapp commented Nov 24, 2016

On Windows you do :

du --max-depth 1 -k --exclude ".*" node_modules

On unix you do :

du -d 1 -k -I ".*" node_modules

According to this post it seems that windows doesn't measure the disk usage the same way as Linux does.

I think we should adjust one of this command to get the same result as the other, but i only have a windows for the moment...

@siddharthkp
Copy link
Owner

@tomapp Thanks! This is helpful.

A pull request will be great! If you make it work for windows, the travis build will take care of linux 😄

@tomapp
Copy link

tomapp commented Nov 25, 2016

Actually don't have solutions for solve this... After many tries i don't get the same value wrote in tests.

@siddharthkp
Copy link
Owner

@tomapp, No worries. Thanks for trying. I'll try once again when I get my hands on a windows machine.

@tomapp
Copy link

tomapp commented Dec 5, 2016

@siddharthkp What do you think about using getFolderSize package for replace result of command ?

@siddharthkp
Copy link
Owner

I started with that, then dropped. Should give it another try.

@tomapp
Copy link

tomapp commented Dec 5, 2016

I'll try too :)

@siddharthkp
Copy link
Owner

@tomapp Thanks! ❤️

@aecz
Copy link

aecz commented Dec 5, 2016

Same issue here on Windows 7 64bit.

'du' is not recognized as an internal or external command,
operable program or batch file.

In the meantime, id suggest adding in the Readme, Windows support in progress

@giscafer
Copy link

giscafer commented Dec 9, 2016

Same issue on Windows 10 64bit

@alshakero
Copy link
Collaborator

Any reason not to use native fs instead of du? I implemented it and works perfect. Should I send a PR?

@siddharthkp
Copy link
Owner

@alshakero yes please

@alshakero
Copy link
Collaborator

@siddharthkp done

@alshakero
Copy link
Collaborator

@siddharthkp BTW, tests may not pass because du measures size on disk, this method measures the actual file size. You'll need to modify the fixtures.

@alshakero
Copy link
Collaborator

All tests passed now. Pushed

@siddharthkp
Copy link
Owner

Released in 0.4.2 🎉

Thanks @alshakero!

@rayno @tomapp @giscafer @aecz Can you update and verify?

@rayno
Copy link
Author

rayno commented Dec 13, 2016

Seems to work :)

@aecz
Copy link

aecz commented Dec 13, 2016

v0.4.2 work in Windows 7 64bit, Node 6.5.0 but does not output size on disk like du on Unix. (Look at core-js size). So this change should be a breaking change (v0.5 ?) as Unix user will see their sizes changed.

npm i -g cost-of-modules@0.4.0
cost-of-modules --no-install --less
npm i -g cost-of-modules@0.4.2
cost-of-modules --no-install --less

v0.4.0 with Cygwin:

┌───────────────────────────┬─────────────┬────────┐
│ name                      │ children    │ size   │
├───────────────────────────┼─────────────┼────────┤
│ pty.js                    │ 2           │ 13.74M │
├───────────────────────────┼─────────────┼────────┤
│ @angular/compiler         │ 23          │ 6.32M  │
├───────────────────────────┼─────────────┼────────┤
│ rxjs                      │ 65          │ 5.60M  │
├───────────────────────────┼─────────────┼────────┤
│ ng2-bootstrap             │ 1           │ 4.25M  │
├───────────────────────────┼─────────────┼────────┤
│ core-js                   │ 0           │ 3.70M  │
├───────────────────────────┼─────────────┼────────┤
│ @angular/core             │ 24          │ 3.51M  │
├───────────────────────────┼─────────────┼────────┤
│ bootstrap                 │ 0           │ 2.44M  │
├───────────────────────────┼─────────────┼────────┤
│ @angular/forms            │ 0           │ 1.45M  │
├───────────────────────────┼─────────────┼────────┤
│ @angular/router           │ 0           │ 1.33M  │
├───────────────────────────┼─────────────┼────────┤
│ @angular/platform-browser │ 0           │ 1.26M  │
├───────────────────────────┼─────────────┼────────┤
│ + 15 modules              │             │        │
├───────────────────────────┼─────────────┼────────┤
│ 25 modules                │ 61 children │ 48.44M │
└───────────────────────────┴─────────────┴────────┘

v0.4.2:

┌───────────────────────────┬─────────────┬────────┐
│ name                      │ children    │ size   │
├───────────────────────────┼─────────────┼────────┤
│ pty.js                    │ 2           │ 13.20M │
├───────────────────────────┼─────────────┼────────┤
│ @angular/compiler         │ 23          │ 5.25M  │
├───────────────────────────┼─────────────┼────────┤
│ rxjs                      │ 65          │ 3.18M  │
├───────────────────────────┼─────────────┼────────┤
│ ng2-bootstrap             │ 1           │ 3.08M  │
├───────────────────────────┼─────────────┼────────┤
│ @angular/core             │ 24          │ 2.49M  │
├───────────────────────────┼─────────────┼────────┤
│ bootstrap                 │ 0           │ 2.17M  │
├───────────────────────────┼─────────────┼────────┤
│ core-js                   │ 0           │ 1.86M  │
├───────────────────────────┼─────────────┼────────┤
│ @angular/forms            │ 0           │ 1.08M  │
├───────────────────────────┼─────────────┼────────┤
│ @angular/router           │ 0           │ 1.05M  │
├───────────────────────────┼─────────────┼────────┤
│ @angular/platform-browser │ 0           │ 0.85M  │
├───────────────────────────┼─────────────┼────────┤
│ + 15 modules              │             │        │
├───────────────────────────┼─────────────┼────────┤
│ 25 modules                │ 61 children │ 37.23M │
└───────────────────────────┴─────────────┴────────┘

@siddharthkp
Copy link
Owner

@aecz Yes, you're right. Published 0.5.0
Unfortunately, can't take 0.4.2 back

@siddharthkp
Copy link
Owner

@rayno Thanks for reporting this
@alshakero Thanks for fixing it!

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

No branches or pull requests

7 participants