modernizr-neue
modernizr-neue copied to clipboard
lodash is not defined on pre-render
I'm getting the bellow error when React.renderToString
is called on the DownloadUI
, through the npm run develop
process
I believe this may have been mentioned before, but this only happened for me after I removed and reinstalled node_modules
. Can anyone replicate?
/Users/joecritchley/Sites/modernizr-neue/frontend/js/download/LeftColumn.js:65
options = _.map(options, function(option) {
^
ReferenceError: _ is not defined
at React.createClass.render (/Users/joecritchley/Sites/modernizr-neue/frontend/js/download/LeftColumn.js:65:15)
at ReactCompositeComponentMixin._renderValidatedComponentWithoutOwnerOrContext (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactCompositeComponent.js:789:34)
at ReactCompositeComponentMixin._renderValidatedComponent (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactCompositeComponent.js:816:14)
at wrapper [as _renderValidatedComponent] (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactPerf.js:70:21)
at ReactCompositeComponentMixin.mountComponent (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactCompositeComponent.js:237:30)
at wrapper [as mountComponent] (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactPerf.js:70:21)
at Object.ReactReconciler.mountComponent (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactReconciler.js:38:35)
at ReactDOMComponent.ReactMultiChild.Mixin.mountChildren (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactMultiChild.js:192:44)
at ReactDOMComponent.Mixin._createContentMarkup (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactDOMComponent.js:289:32)
at ReactDOMComponent.Mixin.mountComponent (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactDOMComponent.js:199:12)
Did you pull down master? This broke and was fixed last week
On Jan 28, 2016, at 5:52 AM, Joe Critchley [email protected] wrote:
I'm getting the bellow error when React.renderToString is called on the DownloadUI.
I believe this may have been mentioned before, but this only happened for me after I removed and reinstalled node_modules. Can anyone replicate?
/Users/joecritchley/Sites/modernizr-neue/frontend/js/download/LeftColumn.js:65 options = _.map(options, function(option) { ^
ReferenceError: _ is not defined at React.createClass.render (/Users/joecritchley/Sites/modernizr-neue/frontend/js/download/LeftColumn.js:65:15) at ReactCompositeComponentMixin._renderValidatedComponentWithoutOwnerOrContext (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactCompositeComponent.js:789:34) at ReactCompositeComponentMixin._renderValidatedComponent (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactCompositeComponent.js:816:14) at wrapper as _renderValidatedComponent at ReactCompositeComponentMixin.mountComponent (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactCompositeComponent.js:237:30) at wrapper as mountComponent at Object.ReactReconciler.mountComponent (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactReconciler.js:38:35) at ReactDOMComponent.ReactMultiChild.Mixin.mountChildren (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactMultiChild.js:192:44) at ReactDOMComponent.Mixin._createContentMarkup (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactDOMComponent.js:289:32) at ReactDOMComponent.Mixin.mountComponent (/Users/joecritchley/Sites/modernizr-neue/node_modules/react/lib/ReactDOMComponent.js:199:12) — Reply to this email directly or view it on GitHub.
@patrickkettner I hadn't pulled (oops!), but still getting the same issue. Steps to reproduce:
-
git fetch upstream
-
git checkout master
-
git merge upstream/master
-
rm -rf node_modules
-
npm i
-
npm run develop
(Also double-checked this by cloning the main repo directly and running the last two steps.)
whoop, just realized I didn't push my changes :(
rebasing off of master, and will push up shortly
@patrickkettner Ah I'm now getting Cannot find module 'lodash'
. I've tried creating an browserify alias, but no luck. Can you replicate with fresh node_modules?
are you on npm < 3?
On Mon, Feb 1, 2016 at 12:36 PM, Joe Critchley [email protected] wrote:
Reopened #72 https://github.com/Modernizr/modernizr-neue/issues/72.
— Reply to this email directly or view it on GitHub https://github.com/Modernizr/modernizr-neue/issues/72#event-534788547.
patrick
Yep, 2.14.7 Edit: @patrickkettner So npm2 doesn't pre-render for me. npm3 does pre-render, but then complains lodash doesn't exist on runtime. :(
Edit 2: npm run deploy
works fine, but npm run develop
still has the issue with npm3 whereby require('lodash')
returns a blank Object. (It seems that lodash module is defined with a service worker, if I'm assuming correctly, so tried clearing the service worker cache, but no luck there.) Any other ideas?
@patrickkettner I'm getting the same error where lodash cannot be found on download/downloader.js:939
resulting in _.map is not a function

Edit: this is happening when running npm run develop
nothing has changed, so the error still exists. you can get around it locally by running npm install lodash
On Wed, Feb 24, 2016 at 1:45 PM, Jordan Stewart [email protected] wrote:
@patrickkettner https://github.com/patrickkettner I'm getting the same error where lodash cannot be found on download/downloader.js:939 resulting in _.map is not a function
[image: npm_lodash_empty] https://cloud.githubusercontent.com/assets/5373779/13302070/f8a83470-db15-11e5-994c-f8b2dd5de161.png
— Reply to this email directly or view it on GitHub https://github.com/Modernizr/modernizr-neue/issues/72#issuecomment-188465937 .
patrick
@patrickkettner I'm not sure if that resolves the issue, still seeing _
showing up as an empty Object.
either way the server is failing to initialize sometimes with this error
/Users/jstewart/src/modernizr/frontend/js/download/LeftColumn.js:79
toggleClassPrefix: this.toggleClassPrefix
^
TypeError: Cannot read property 'toggleClassPrefix' of undefined
at /Users/jstewart/src/modernizr/frontend/js/download/LeftColumn.js:79:32
@patrickkettner I also have troubles setting the page up to fix a few things (node8 npm5.6). Bitrot? Or can you still setup and deploy it?