atticoos / gulp-ng-config

:wrench: Create AngularJS constants from a JSON config file
MIT License
173 stars 35 forks source link

Error after dependencies upgrade #17

Closed ilianaza closed 9 years ago

ilianaza commented 9 years ago
TypeError: First argument needs to be a number, array or string.
  at new Buffer (buffer.js:188:15)
  at DestroyableTransform._transform (.../node_modules/gulp-ng-config/gulp-ng-config.js:69:21)
atticoos commented 9 years ago

What was upgraded? This projects dependencies? Those shouldn't be modified

scic commented 9 years ago

This error message is because your project has a dependency on an older lodash version (< 3.0.0). In the last release ng-config switched to lodash ^3.0.1. You need to update your lodash version to at least this version or use the previous release of ng-config. There should have been a warning about a dependency mismatch during the install.

atticoos commented 9 years ago

The latest release v1.0.0 uses ^2.4.1. Not sure how this is a bug, since yes, upgrading a dependency will likely break this package as it has the versions it currently supports.

https://github.com/ajwhite/gulp-ng-config/pull/15 bumps lodash to ^3.0.1, but that has not been released yet, and addresses any incompatibilities. That is living on develop branch right now

scic commented 9 years ago

Yes. Sorry. Then its the other way around with the dependency mismatch. The project uses lodash > 3 and ng-config is on 2.4. No its not a bug and using the branch should resolve the problem. Am 11.03.2015 17:12 schrieb "Atticus White" notifications@github.com:

The latest release v1.0.0 https://github.com/ajwhite/gulp-ng-config/blob/v1.0.0/package.json#L32 uses ^2.4.1. Not sure how this is a bug, since yes, upgrading a dependency will likely break this package as it has the versions it currently supports.

15 https://github.com/ajwhite/gulp-ng-config/pull/15 bumps lodash to

^3.0.1, but that has not been released yet, and addresses any incompatibilities. That is living on develop branch right now

— Reply to this email directly or view it on GitHub https://github.com/ajwhite/gulp-ng-config/issues/17#issuecomment-78295788 .

atticoos commented 9 years ago

Ohhhhhh, I see what you're saying. Gotcha.

But still, shouldn't gulp-ng-config be installing its own separate version of loadash in its own node_modules directory separate than that of the parent project??

scic commented 9 years ago

Yes it's indpendend. But npm does try to be clever. So if the project is on lodash 2.4.1. And I do an npm install and afterwards an install of gulp-ng-config. Then lodash will not be installed in the node_modules of gulp-ng-config. Since it is already in the projects node_modules and satisfies the version requirements. So npm tries to save some space.

If I later update the project dependency of lodash to 3.0.1 then only the projects lodash folder gets updated after an "npm install". And it prints the warning: npm WARN unmet dependency project/node_modules/gulp-ng-config requires lodash@'^2.4.1' but will load npm WARN unmet dependency project/node_modules/lodash, npm WARN unmet dependency which is version 3.0.1 But it won't install lodash into gulp-ng-config again.

So the issue creator should just delete the whole node_modules folder and run "npm install" again. Its not a bug of gulp-ng-config.

PS: I learned that in the same way. ;-)

atticoos commented 9 years ago

Terrific explanation! Thanks :)

atticoos commented 9 years ago

@scic has made some valid, and quite educational points as to how this is reproducible and doesn't sound like a bug on this end. It doesn't sound like there's much of a way around it, other than reinstalling your node_modules completely. Mind you, even though this isn't a solution to the overall problem we risk with npm install, #15 does upgrade to lodash ^3.0.1 so the next release will indeed have you covered.

@ilianaza if this sounds like the issue you ran into, please close

atticoos commented 9 years ago

@ilianaza was that able to solve your problem?

ilianaza commented 9 years ago

Yes. That resolved this issue. Thank you @scic and @ajwhite