carlitoplatanito / gulp-nunjucks-render

[Gulp](https://github.com/wearefractal/gulp) plugin to render [Nunjucks](http://mozilla.github.io/nunjucks/) templates
149 stars 33 forks source link

Lodash issue #52

Closed zenopopovici closed 6 years ago

zenopopovici commented 7 years ago

Please update lodash dependency to work around this issue: https://github.com/lodash/lodash/commit/fe3d86bf13a3f136fc26265dce84d738a7aa490c

else we get:

[00:16:43] 'compileTemplatesStatic' errored after 145 ms
[00:16:43] TypeError: _.defaultsDeep is not a function
    at Object.module.exports (/Users/Zeno/Sites/Graffino/Projects/DotWhite/node_modules/gulp-nunjucks-render/index.js:18:15)
    at compileTemplatesStatic (/Users/Zeno/Sites/Graffino/Projects/DotWhite/gulp/bundle.js:128:19)
    at bound (domain.js:280:14)
    at runBound (domain.js:293:12)
    at asyncRunner (/Users/Zeno/Sites/Graffino/Projects/DotWhite/node_modules/async-done/index.js:36:18)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)
kristijanhusak commented 7 years ago

According to your error, the issue is that you are missing lodash somehow, not that there's the problem in defaultsDeep function. I ran tests with lodash v3 and v4, everything passed properly. Are you using underscore.js maybe?

zenopopovici commented 7 years ago

No ... and I've also tried removing the node_modules folder and running npm install. After running npm install lodash --save-dev everything worked as expected.

What I have:

├── autoprefixer@6.5.0
├── backstopjs@2.0.2
├── critical@0.8.0
├── csswring@5.1.0
├── debounce@1.0.0
├── del@2.2.2
├── es6-promise@4.0.3
├── fs@0.0.2
├── gulp@4.0.0-alpha.2 (git://github.com/gulpjs/gulp.git#d8f5c90a0622d19ef1943a2a3d02dc50e3c853e7)
├── gulp-bump@2.4.0
├── gulp-combine-mq@0.4.0
├── gulp-concat@2.6.0
├── gulp-copy@0.0.2
├── gulp-cssmin@0.1.7
├── gulp-data@1.2.1
├── gulp-exec@2.1.2
├── gulp-file@0.3.0
├── gulp-filter@4.0.0
├── gulp-git@1.11.3
├── gulp-group-concat@1.1.5
├── gulp-htmlhint@0.3.1
├── gulp-htmlmin@3.0.0
├── gulp-if@2.0.1
├── gulp-imagemin@3.0.3
├── gulp-inject@4.1.0
├── gulp-jshint@2.0.1
├── gulp-livereload@3.8.1
├── gulp-load-plugins@1.3.0
├── gulp-modernizr@1.0.0-alpha
├── gulp-notify@2.2.0
├── gulp-nunjucks@2.3.0
├── gulp-nunjucks-render@2.0.0
├── gulp-order@1.1.1
├── gulp-plumber@1.1.0
├── gulp-postcss@6.2.0
├── gulp-rename@1.2.2
├── gulp-replace@0.5.4
├── gulp-rimraf@0.2.0
├── gulp-sequence@0.4.6
├── gulp-sourcemaps@2.0.0-alpha
├── gulp-stylint@3.0.0
├── gulp-stylus@2.5.0
├── gulp-svg-sprite@1.3.6
├── gulp-ttf2woff@1.1.0
├── gulp-ttf2woff2@2.0.2
├── gulp-uglify@2.0.0
├── gulp-uncss@1.0.6
├── gulp-util@3.0.7
├── gulp-xo@0.13.0
├── htmlhint-stylish@1.0.3
├── imagemin-mozjpeg@6.0.0
├── imagemin-pngquant@5.0.0
├── jeet@6.1.5
├── lodash@4.16.2
├── main-bower-files@2.13.1
├── minimist@1.2.0
├── normalize.styl@3.0.3
├── npm-check-updates@2.8.0
├── postcss-quantity-queries@0.4.0
├── rupture@0.6.1
├── stylint-stylish@1.4.0
└── xo@0.16.0

If it its easier, here's our flow we're using (you can clone it): https://github.com/Graffino/GulpFlow

kristijanhusak commented 7 years ago

defaultsDeep was added in version 3.10.0, according to docs.

Some of packages you are using in your project have lodash v2.* as their dependency, like gulp-bump (nested dependency), and few other. I guess that is causing the issue, since the error is that the defaultsDeep is undefined, not that it's misbehaving. By installing it in the root, priority for the require was fixed, so it's using the proper version. I guess only solution is to add lodash to your dev dependencies.

jbravar commented 7 years ago

Looks like this package lists "lodash": "^3.3.0" as it's dependency. Maybe it should be >3.10.0?