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

lodash is not defined on pre-render #72

Open
joecritch opened this issue Jan 28, 2016 · 10 comments
Open

lodash is not defined on pre-render #72

joecritch opened this issue Jan 28, 2016 · 10 comments

Comments

@joecritch
Copy link
Contributor

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)
@patrickkettner
Copy link
Member

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.

@joecritch
Copy link
Contributor Author

@patrickkettner I hadn't pulled (oops!), but still getting the same issue. Steps to reproduce:

  1. git fetch upstream
  2. git checkout master
  3. git merge upstream/master
  4. rm -rf node_modules
  5. npm i
  6. npm run develop

(Also double-checked this by cloning the main repo directly and running the last two steps.)

@patrickkettner
Copy link
Member

whoop, just realized I didn't push my changes :(

rebasing off of master, and will push up shortly

@joecritch
Copy link
Contributor Author

@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?

@joecritch joecritch reopened this Feb 1, 2016
@patrickkettner
Copy link
Member

are you on npm < 3?

On Mon, Feb 1, 2016 at 12:36 PM, Joe Critchley [email protected]
wrote:

Reopened #72 #72.


Reply to this email directly or view it on GitHub
#72 (comment).

patrick

@joecritch
Copy link
Contributor Author

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?

@jstewsy
Copy link

jstewsy commented Feb 24, 2016

@patrickkettner I'm getting the same error where lodash cannot be found on download/downloader.js:939 resulting in _.map is not a function

npm_lodash_empty

Edit: this is happening when running npm run develop

@patrickkettner
Copy link
Member

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
#72 (comment)
.

patrick

@jstewsy
Copy link

jstewsy commented Feb 26, 2016

@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

@rejas
Copy link
Member

rejas commented May 25, 2018

@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?

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

No branches or pull requests

4 participants